On Friday, 20 August 2021 at 21:19:09 UTC, Ruby The Roobster wrote:
> MessageBoxA(null, "Error", cast(char)[])e.msg,MB_OK | ICON_ERROR);
use std.string.toStringz to ensure that e.msg is 0-terminated.
August 20, 2021 Re: std.stdio.File is throwing with the message of: "Access Violation" | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ruby The Roobster | On Friday, 20 August 2021 at 21:19:09 UTC, Ruby The Roobster wrote: >
use std.string.toStringz to ensure that e.msg is 0-terminated. |
August 21, 2021 Re: std.stdio.File is throwing with the message of: "Access Violation" | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ruby The Roobster | On Friday, 20 August 2021 at 21:19:09 UTC, Ruby The Roobster wrote: >int myWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int iCmdShow)
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; |
August 21, 2021 Re: std.stdio.File is throwing with the message of: "Access Violation" | ||||
---|---|---|---|---|
| ||||
Posted in reply to evilrat | On Saturday, 21 August 2021 at 06:08:17 UTC, evilrat wrote: >First parameter for CreateWindow should be window class string that you used in >wndclass.lpszClassName = appName.toUTF16z; Fix: |
August 21, 2021 Re: std.stdio.File is throwing with the message of: "Access Violation" | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ruby The Roobster | On Saturday, 21 August 2021 at 23:50:08 UTC, Ruby The Roobster wrote: >On Saturday, 21 August 2021 at 06:08:17 UTC, evilrat wrote: >First parameter for CreateWindow should be window class string that you used in >wndclass.lpszClassName = appName.toUTF16z; Fix: Anyways, this isn't an issue anymore. I'm just not gonna use Win32 API. |
August 21, 2021 Re: std.stdio.File is throwing with the message of: "Access Violation" | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ruby The Roobster | On Saturday, 21 August 2021 at 23:50:08 UTC, Ruby The Roobster wrote:
> wndclass.lpszClassName = "Test"; //May need casting...
don't cast it just use the w suffix
wndclass.lpszClassName = "Test"w;
casts are usually indicating a mistake
|
August 22, 2021 Re: std.stdio.File is throwing with the message of: "Access Violation" | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ruby The Roobster | On Saturday, 21 August 2021 at 23:50:51 UTC, Ruby The Roobster wrote: >On Saturday, 21 August 2021 at 23:50:08 UTC, Ruby The Roobster wrote: >On Saturday, 21 August 2021 at 06:08:17 UTC, evilrat wrote: >First parameter for CreateWindow should be window class string that you used in >wndclass.lpszClassName = appName.toUTF16z; Fix: Anyways, this isn't an issue anymore. I'm just not gonna use Win32 API. Of course this is the "fix", but your example works fine and opens a file when window is created. What I don't really understand is why you are trying to remove import core.sys.windows.windows which contains declarations for HWND, HINSTANCE and family... It simply won't compile without it. |