On Friday, 20 August 2021 at 21:19:09 UTC, Ruby The Roobster wrote:

int myWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int iCmdShow)
{
    // ...
    if(!RegisterClassA(&wndclass))
    {

        return 0;
    }

    hwnd = CreateWindowA( "Test",
                         "Test",
                         WS_OVERLAPPEDWINDOW,
                         CW_USEDEFAULT,
                         CW_USEDEFAULT,
                         CW_USEDEFAULT,
                         CW_USEDEFAULT,
                         NULL,
                         NULL,
                         hInstance,
                         NULL);

    ShowWindow(hwnd, iCmdShow);
    UpdateWindow(hwnd);


See the results(what matters is if you get the "Access Violation" error or not, everything else is irrelevant).

Fix your code first.

Your code is broken and in its current state fails to create window, hwnd = 0. GetLastError reports 1407 - ERROR_CANNOT_FIND_WND_CLASS.

First parameter for CreateWindow should be window class string that you used in

wndclass.lpszClassName = appName.toUTF16z;

Reply via email to