which dll is loaded?

It is often helpful to know which dll file your exe has loaded at runtime. If you uncomment the first HINSTANCE line, you can specify which path to load a dll, or allow the OS to find one for you.

// explicitly load dbExpress driver
// HINSTANCE hinstLib = LoadLibrary(TEXT("C:\path\to\specific\location\somefile.dll"));
 
HINSTANCE hinstLib = LoadLibrary(TEXT("somefile.dll"));
if (hinstLib == NULL) {
    ShowMessage("ERROR: unable to load DLL\n");
    return 1;
}
 
// find the path/filename of the loaded driver
LPTSTR  strDLLPath1 = new TCHAR[_MAX_PATH];
if( GetModuleFileName((HINSTANCE)hinstLib, strDLLPath1, _MAX_PATH) ){
    ShowMessage(String(strDLLPath1));
}

See Also