Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to call a Dll

How to call a Dll

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
5 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    tasumisra
    wrote on last edited by
    #1

    i want to know how to call a DLL and what is the difference between both 1.cocreate 2.Import dll Thank you...

    vikas da

    C H CPalliniC N 4 Replies Last reply
    0
    • T tasumisra

      i want to know how to call a DLL and what is the difference between both 1.cocreate 2.Import dll Thank you...

      vikas da

      C Offline
      C Offline
      Cedric Moonen
      wrote on last edited by
      #2

      tasumisra wrote:

      i want to know how to call a DLL

      You don't call a dll. You first load the dll and when this is succesfull you can retrieve the addresses of functions in the dll and call those functions.

      Cédric Moonen Software developer
      Charting control [v1.5] OpenGL game tutorial in C++

      1 Reply Last reply
      0
      • T tasumisra

        i want to know how to call a DLL and what is the difference between both 1.cocreate 2.Import dll Thank you...

        vikas da

        H Offline
        H Offline
        Hamid Taebi
        wrote on last edited by
        #3

        Call no load yes. How to load a dynamic link library (DLL) into a Microsoft Visual C++ 6.0 project[^] And see Step by Step: Calling C++ DLLs from VC++ and VB - Part 4[^]( Hans explains for you four parts for dlls.) ;)

        Of one Essence is the human race thus has Creation put the base One Limb impacted is sufficient For all Others to feel the Mace (Saadi )

        1 Reply Last reply
        0
        • T tasumisra

          i want to know how to call a DLL and what is the difference between both 1.cocreate 2.Import dll Thank you...

          vikas da

          CPalliniC Offline
          CPalliniC Offline
          CPallini
          wrote on last edited by
          #4

          tasumisra wrote:

          1.cocreate

          Do you mean CoCreateInstance [^]? BTW: What about DLL's documentation [^]? :)

          If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
          This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
          [My articles]

          In testa che avete, signor di Ceprano?

          1 Reply Last reply
          0
          • T tasumisra

            i want to know how to call a DLL and what is the difference between both 1.cocreate 2.Import dll Thank you...

            vikas da

            N Offline
            N Offline
            nyeboy
            wrote on last edited by
            #5

            There are two methods generally. One:Dynamic load DLL HINSTANCE hInst; //DLL2.dll must in current directory. //Implement on a button clicked event. hInst=LoadLibrary("DLL2.dll"); typedef int (*ADDPROC) (int a,int b); ADDPROC add=(ADDPROC)GetProcAddress(hInst,"Add"); if(!add) { MessageBox("Failed to get address!"); return; } int ret=add(5,3); CString str; str.Format("%d",ret); MessageBox(str); Two:Static load DLL First place DLL2.dll and DLL2.lib into current directory, then set project/settings/Link to load DLL2.lib _declspec(dllimport) int add(int a,int b); void CDLL2TestDlg::OnButton1() { int a=add(5,5);//use this method from dll }

            studing is processing in this life.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups