Hello
I am using the Mfc to Qt migration solution, to migrate my Mfc plugin to Qt. My Mfc plugin is loaded in third party Mfc app. Basically I am using the following example Qt based Application Extension :
BOOL WINAPI DllMain( HINSTANCE hInstance, DWORD dwReason, LPVOID ) {
static bool ownApplication = FALSE;
if ( dwReason == DLL_PROCESS_ATTACH )
ownApplication = QMfcApp::pluginInstance( hInstance );
if ( dwReason == DLL_PROCESS_DETACH && ownApplication )
delete qApp;
return TRUE;
}
I read the code of pluginInstance function, int the Qt Sources,and notice that pluginInstance calls LoadLibrary and SetWindowsHook inside.
Everything is working ok , so far . But I have the following concern : It is forbidden to call LoadLibrary and functions from user32.dll like SetWindowsHook from DllMain. I read that in msdn doc for DllMain. So , if this is unsafe why the offical Qt site says to call pluginInstance in DllMain? Qt based Application Extension Maybe I am missing something