Calling an external cwinapp dll from MainWindow



  • I am rewriting an MFC GUI using Qt 4.8. The application loads dlls from an ini file at startup. The DLLs are derived from CWinApp and when loaded, called an exported function from the (mfc gui's) main application via the following:

    @void *GetInterface(int Reserved)
    {
    AFX_MANAGE_STATE(AfxGetStaticModuleState());
    return (void *)&TheInterface;
    }
    @

    Currently my DLLs are loaded successfully using QLibrary, however, the InitInstance function within the DLLs are never called, if it were called, it should call another exported function (from the main application). I thought I only needed to rewrite the GetInterface function but I am not sure how to go about the best way to do it.
    I tried:
    @
    void *GetInterface(int Reserved)
    {
    return (void *)pMyMainWin->winId();
    }
    @

    where pMyMainWin is an extern pointer to a derived class of QMainWindow

    Or do I need to rewrite the GetInterface function and something else? Changing/udpating the DLLs at this time is not an option. The MFC to Qt migration tutorial has been confusing at best. Any suggestions?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.