std.stdio.File is throwing with the message of: "Access Violation"

evilrat evilrat666 at gmail.com
Sat Aug 21 06:08:17 UTC 2021


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;



More information about the Digitalmars-d-learn mailing list