mingw g++ Windows Subsystem WinMain not getting hInstance value

240 Views Asked by At

I'm converting a VS2015 C++ directx/winforms app to VS code using mingw G++ (both on windows 10).

I have it compiling and linking after adding the -mwindows option (and a whole bunch of libraries) but upon stepping into the WinMain there is no value in hInstance.

#include <objbase.h>
#include <windows.h>

int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
    LoadString(hInstance, IDS_APP_TITLE,g_szAppName, MAX_LOADSTRING);
...

Which results in anything depending on it like LoadString or RegisterClassEx not working.

What should I be looking for?

0

There are 0 best solutions below