On Thursday, 19 August 2021 at 13:47:56 UTC, Ruby The Roobster wrote:
On Thursday, 19 August 2021 at 03:25:31 UTC, Jesse Phillips wrote:
 tell me what went wrong.  I am using DMD 2.097.2
:

```d
case WM_CREATE: //Executed on creation of the window...
   try   {
      import core.stdc.stdio;
      FILE* file;
file = fopen("file","r"); //NOTE: Replace 'file' with any file on the system...
      fclose(file);
   }
   catch(Throwable e)   {
MessageBoxA(null,cast(const(char)*)e.msg,"ERROR",MB_OK | MB_ICONERROR);
   }
```
This works, no Message Box should be displayed(Note: use 2.097.2, this is the version I am using, and I don't know about if this same bug happens on earlier versions).

Now do this:

```d
case WM_CREATE:
   try   {
      import std.stdio;
File file = File("file","r"); //NOTE: Again, replace 'file' with any file on the system...
      file.close();
   }
   catch(Throwable e)   {
MessageBoxA(null, cast(const(char)*)e.msg, "ERROR", MB_OK | MB_ICONERROR);
}
```

For me, this code generates the Message Box. Does this happen for you?

I don't have a good means to run with this, but it does not look like what I suggested.

Reply via email to