Click here to Skip to main content
15,886,005 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
GeneralRe: How to Disable open drop down Pin
yaswanthdasari25-Oct-17 23:50
yaswanthdasari25-Oct-17 23:50 
QuestionHow To Add a Dll TO MFC Application in visual Studio Pin
Member 1347149317-Oct-17 21:50
Member 1347149317-Oct-17 21:50 
QuestionRe: How To Add a Dll TO MFC Application in visual Studio Pin
Richard MacCutchan17-Oct-17 21:58
mveRichard MacCutchan17-Oct-17 21:58 
AnswerRe: How To Add a Dll TO MFC Application in visual Studio Pin
Member 1347149317-Oct-17 22:09
Member 1347149317-Oct-17 22:09 
GeneralRe: How To Add a Dll TO MFC Application in visual Studio Pin
Richard MacCutchan17-Oct-17 22:12
mveRichard MacCutchan17-Oct-17 22:12 
GeneralRe: How To Add a Dll TO MFC Application in visual Studio Pin
Member 1347149317-Oct-17 22:29
Member 1347149317-Oct-17 22:29 
GeneralRe: How To Add a Dll TO MFC Application in visual Studio Pin
Richard MacCutchan17-Oct-17 22:45
mveRichard MacCutchan17-Oct-17 22:45 
AnswerRe: How To Add a Dll TO MFC Application in visual Studio Pin
Jochen Arndt17-Oct-17 22:44
professionalJochen Arndt17-Oct-17 22:44 
To use functions from a DLL you have two choices: Early and late binding.

Early binding:
Link your application with the DLL by using the #import directive in one file (usually a source file using functions from the DLL) specifying the file name (usually without extension or with .lib), or add the .lib file to your project settings (Linker - Input).
Include the header file and call the functions defined in that file.

Late binding:
This is only necessary if the DLL might not be present when your application is executed or you do not have a .lib file. Then use LoadLibrary and GetProcAddress like in your above example. But check both return values to be not NULL. Have a look at the header file (if present), to know how to define the function prototypes. Example:
C++
typedef int (__stdcall *ConnectByAddressfuncPtr)(short Addr); 

ConnectByAddressfuncPtr LibMainConnectByAddress = NULL;
HMODULE hLib = LoadLibrary(_T("mcl_gen.dll"));
if (hLib)
    LibMainConnectByAddress = (ConnectByAddressfuncPtr)GetProcAddress(hLib,"ConnectByAddress");
if (LibMainConnectByAddress)
    LibMainConnectByAddress(0x01);
Note that I have initialised the function pointer with NULL and checked it before calling the function. Note also the __stdcall in the prototype declaration. It defines the calling convention used by the DLL. You have to check which is used (by inspecting the header file or asking the provider). __stdcall is common but it might be also __cdecl.
GeneralRe: How To Add a Dll TO MFC Application in visual Studio Pin
Member 1347149317-Oct-17 23:13
Member 1347149317-Oct-17 23:13 
GeneralRe: How To Add a Dll TO MFC Application in visual Studio Pin
Jochen Arndt17-Oct-17 23:29
professionalJochen Arndt17-Oct-17 23:29 
GeneralRe: How To Add a Dll TO MFC Application in visual Studio Pin
Richard MacCutchan18-Oct-17 0:16
mveRichard MacCutchan18-Oct-17 0:16 
GeneralRe: How To Add a Dll TO MFC Application in visual Studio Pin
Member 1347149318-Oct-17 0:58
Member 1347149318-Oct-17 0:58 
QuestionRe: How To Add a Dll TO MFC Application in visual Studio Pin
Richard MacCutchan18-Oct-17 1:18
mveRichard MacCutchan18-Oct-17 1:18 
GeneralRe: How To Add a Dll TO MFC Application in visual Studio Pin
Jochen Arndt18-Oct-17 1:40
professionalJochen Arndt18-Oct-17 1:40 
AnswerRe: How To Add a Dll TO MFC Application in visual Studio Pin
Michael Haephrati22-Oct-17 2:22
professionalMichael Haephrati22-Oct-17 2:22 
Questionusing /clr switch for ATL application raises an exception when the application is terminating. Pin
Vijjuuu.23-Aug-17 0:00
Vijjuuu.23-Aug-17 0:00 
QuestionGetUsbDrive letter error Pin
Member 101933363-Aug-17 0:27
Member 101933363-Aug-17 0:27 
QuestionRe: GetUsbDrive letter error Pin
Richard MacCutchan3-Aug-17 1:18
mveRichard MacCutchan3-Aug-17 1:18 
AnswerRe: GetUsbDrive letter error Pin
Member 101933363-Aug-17 2:26
Member 101933363-Aug-17 2:26 
GeneralRe: GetUsbDrive letter error Pin
Richard MacCutchan3-Aug-17 2:28
mveRichard MacCutchan3-Aug-17 2:28 
GeneralRe: GetUsbDrive letter error Pin
Member 101933363-Aug-17 2:36
Member 101933363-Aug-17 2:36 
GeneralRe: GetUsbDrive letter error Pin
Richard MacCutchan3-Aug-17 2:37
mveRichard MacCutchan3-Aug-17 2:37 
GeneralRe: GetUsbDrive letter error Pin
Richard MacCutchan3-Aug-17 2:32
mveRichard MacCutchan3-Aug-17 2:32 
QuestionUse ATL COM DLL in VB Script which written in C++ Pin
GTAVLover11-Jul-17 15:03
GTAVLover11-Jul-17 15:03 
AnswerRe: Use ATL COM DLL in VB Script which written in C++ Pin
Richard MacCutchan11-Jul-17 21:35
mveRichard MacCutchan11-Jul-17 21:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.