I am trying to create a new frame window with toolbars inside a dll. I was able to create the frame and the toolbars but however the messages do not work properly in the CToolbar. Particularly the ON_UPDATE_COMMAND_UI messages are never called in the DLL. After some research I came to know that this is because PreTranslateMessage(MSG* pMsg) and OnIdle(LONG lCount)
need to be called. But my calling application is Delphi based and this cannot be done.
After research I came to know that this is best possible from an Extension dll. Since MFC extension dlls can only be called from an MFC application. I thought of the following solution.
Delphi calls an regular MFC dll The MFC dll calls the Extension dll.
But I have run into problems because of asserts in in MFC AfxGetResourceHandle() and AfxGetInstanceHandle().
But I am also aware that AFX_MANAGE_STATE(AfxGetStaticModuleState()); cannot be called from an extension dll.
Does anybody have a solution for this problem?