AndyHollywood
Programmer
The program I am trying to adapt was first writen using a dll with the entry point as LibMain, I am now trying to use DllMain, but don't really understand where the equivilant parts in both are?!
The old usd to be:
BOOL CALLBACK LibMain(HANDLE hModule, DWORD dwReason, LPVOID lpReserved)
{
hInstance = hModule;
return 1;
}
I want to use DllMain (for no particular reason I was just told it was the new standard!) but am unsure where to put the code so it will act the same?!
BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason, LPVOID lpReserved)
{
switch( fdwReason )
{
case DLL_PROCESS_ATTACH:
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
would it go into process attach or thread attach? or should it be somewhere completly different?!
Also what are the benefits of dllmain over libmain?!
Cheers in advance
Andy
The old usd to be:
BOOL CALLBACK LibMain(HANDLE hModule, DWORD dwReason, LPVOID lpReserved)
{
hInstance = hModule;
return 1;
}
I want to use DllMain (for no particular reason I was just told it was the new standard!) but am unsure where to put the code so it will act the same?!
BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason, LPVOID lpReserved)
{
switch( fdwReason )
{
case DLL_PROCESS_ATTACH:
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
would it go into process attach or thread attach? or should it be somewhere completly different?!
Also what are the benefits of dllmain over libmain?!
Cheers in advance
Andy