Click to See Complete Forum and Search --> : Beginner DLL question


scooby
October 1st, 1999, 12:35 PM
I am a intermediatly experienced C++ programmer, but have never worked with DLL's. When looking through a list of what is done when my computer boots up i saw that "rundll32.exe someDLLname, someFunctioncall" is executed. What i am wondering is where can i get a list of what the DLL's on my system contain and how can i use them, if i can at all.

Oleg Lobach
October 4th, 1999, 08:08 AM
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.

gbo
October 4th, 1999, 08:30 AM
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.