Tuesday, July 28, 2009

How do i call a function in a DLL file from another C++ (MFC ) application?

Here is an example of how to do it in C++.


Assume you want to use have a DLL named MyDll.dll, which contains a function,





bool Function1(int)





...


typedef bool Function1(int);


typedef Function1* pFunction1;





...





HMODULE DLLHandle;


DLLHandle = LoadLibrary("MyDll.dll");





pFunction1 pF1 = (pFunction1) GetProcAddress (DLLHandle,"Function1");


...


to call:


bool bSuccess = pF1(1);

How do i call a function in a DLL file from another C++ (MFC ) application?
This will help you certainly


http://www.codeproject.com/dll/vbactivex...


No comments:

Post a Comment