⚠️ Forum Maintenance: Feb 6th, 8am - 14pm (UTC+2)

How do I get the Windows HINSTANCE handle?

  • Hi Guys,
    I am integrating an SDK that requires access to the HINSTANCE handle that Win32 provides in its WinMain call like this:WinMain(HINSTANCE hInstance,.....

    I have tried QApplication::instance(), but that doesn't seem to be satisfactory to the SDK that needs the handle.
    Does anyone know what procedure I need to call?

    Thank you, :)

  • So I think you are looking for "WId QWidget::winId () const" from your mainwindow and not from the application object.

  • If you really need the HINSTANCE, you can use

    HINSTANCE hInstance = (HINSTANCE)::GetModuleHandle(NULL);

  • Thank you both.

    I have tried both solutions (plus about 3 others), but the SDK doesn't seem to be responding. I believe I will need to compile and debug within the SDK - something else must be going on.

    Thanks agian for your help and quick replies - sincerely appreciated! :)

Log in to reply