Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic DLL

Status
Not open for further replies.

exodus300

Programmer
Mar 22, 2002
262
AU
I can create a DLL in CB5, and use that dll by adding the .lib file to the project, so the DLL is automatically loaded when the program starts.

But how can I dynamically load a dll and run a function exported from that dll, at a specified point in my program (eg. button click)? [Thanks in advance|Hope I helped you]
Exodus300
World-Wide Alliance of Evil and Twisted People
[red]"Experimentation by Example is the best learning tool" - Exodus300[/red]
Code:
if (pop_tarts == 0)
{
   tantrum = 1;
}
[pc3]
 
Hi,
you have to add a function to the file where the dll Entry point exists:

#include "MyFunc.h"
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved)
{
}
void MyFunction(void){
// doSomething();
}

Then you have to add a .h file, that contains the prototype of the function:

extern __declspec(dllexport) void MyFunction(void);

In your programm, you can now add the .h file, and use the function with : MyFunction()

CU Stummel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top