Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Calling an external cwinapp dll from MainWindow
Qt 6.11 is out! See what's new in the release blog

Calling an external cwinapp dll from MainWindow

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    k1mray2000
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved