Re: Beginner DLL question
Hi,
The dll used by different applications are listed in the registry: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SharedDLLs
To call function from, dll try something like this:
typedef UINT (CALLBACK* LPFNDLLFUNC1)(DWORD,UINT);
.
.
.
HINSTANCE hDLL; // Handle to DLL
LPFNDLLFUNC1 lpfnDllFunc1; // Function pointer
DWORD dwParam1;
UINT uParam2, uReturnVal;
hDLL = LoadLibrary("MyDLL");
if (hDLL != NULL)
{
lpfnDllFunc1 = (LPFNDLLFUNC1)GetProcAddress(hDLL,
"DLLFunc1");
if (!lpfnDllFunc1)
{
// handle the error
FreeLibrary(hDLL);
return SOME_ERROR_CODE;
}
else
{
// call the function
uReturnVal = lpfnDllFunc1(dwParam1, uParam2);
}
}
Hope this helps,
Oleg.
Re: Beginner DLL question
Some Practical tips:
1. To get the exported function list of a dll.
Right click on the DLL and look at the function export table in the DLL with QuickView
2. To investigate what DLLs a program uses
Surf to http://www.sysinternals.com/
look for utilities and download the
HandleEx utility.
Best Regards,
GBO.