Hi all,
i have a weird problem.
I've build a framework for myself that can take plugins.
The framework itself is a mfc extension dll and exports some baseclasses to be inherited by the plugins. The classes are exported via the AFX_EXT_CLASS macro.
Every plugin has to provide a cdialog, because every plugin will be shown as a tab.
The plugins are loaded via LoadLibrary at runtime.
Every plugin has a exported method wich instatiates a CDialog and returns the pointer.
I get the exprted method via GetProcAddress(...) and call it afterwards.
So far so good, the dialog of every plugin can be displayed.
But when it comes to overriding the method PreTranslateMessage in the plugins, it won't work. PreTranslateMessage is never called.
It took my bloody ages to track that problem down.
The point is, the initialization method of the plugin is as follows
inline __declspec(dllexport) void* getInstance(xpsc::TabManag
er& tabMgr)
{
AFX_MANAGE_STATE(AfxGetSta
ticModuleS
tate());
return new xpsc::ipc::ConnectionsTab(
tabMgr);
}
The weird thing is, if i comment out the line "AFX_MANAGE_STATE(AfxGetSt
aticModule
State());"
PreTranslateMessage gets called but i cannot access any resources from this plugin dll.
If the line is back in, PreTranslateMessage does not get called but i can access all the resources.
I know the the AFX_MANAGE_STATE macro is there to do some 'magic' to let me access the resources of my plugin dll and not of the application. But can anyone tell me why PreTranslateMessage does not get called??
I hope i've described the problem as detailed as needed. If not i'll try to put up more information on that.
I've read a lot on the net about similar problems, but i never understood on how to solve this.
Many thanks in advance for any advice.
Have a nice day!
Greetings, -ulf-
Start Free Trial