[Qt-interest] Regarding Mfc to Qt migration
elizabeta petreska
elizabeta.petreska at gmail.com
Wed Nov 4 14:44:46 CET 2009
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
http://doc.trolltech.com/solutions/4/qtwinmigrate/winmigrate-qt-dll-example.html
<http://doc.trolltech.com/solutions/4/qtwinmigrate/winmigrate-qt-dll-example.html%20>
As you may notice , pluginInstance is called in the DllMain function.
I read the code od pluginInstance, and it looks like this :
bool QMfcApp::pluginInstance(Qt::HANDLE plugin)
{
if (qApp)
return FALSE;
QT_WA({
hhook = SetWindowsHookExW(WH_GETMESSAGE, QtFilterProc, 0,
GetCurrentThreadId());
}, {
hhook = SetWindowsHookExA(WH_GETMESSAGE, QtFilterProc, 0,
GetCurrentThreadId());
});
int argc = 0;
(void)new QApplication(argc, 0);
if (plugin) {
char filename[256];
if (GetModuleFileNameA((HINSTANCE)plugin, filename, 255))
LoadLibraryA(filename);
}
return TRUE;
}
As you may notice , pluginInstance calls LoadLibrary.
Everything is working ok , so far . But I have the following concern :
The pluginInstance function is called inside DllMain. And pluginInstance is
calling LoadLibrary.
Somewhere I read that is WRONG and forbidden to call LoadLibrary in
DllMain.
So my question is it safe to call pluginInstance in DllMain ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091104/8791c56e/attachment.html
More information about the Qt-interest-old
mailing list