Help with Win32: PostQuitMessage(0) doesn't post WM_QUIT apparently, because the message loop is not exited.
Ruby The Roobster
michaeleverestc79 at gmail.com
Fri Aug 13 00:30:59 UTC 2021
Here is the message loop:
```d
while(GetMessage(&msg, hwnd,0,0)) {
if(msg.message == WM_QUIT)
break;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
```
The WndProc(LRESULT CALLBACK):
```d
extern(Windows)
LRESULT WndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM
lparam) nothrow {
switch(msg) {
case WM_CREATE:
//...
return 0;
break;
case WM_DESTROY:
try {
entity.terminate();
}
catch(Throwable e) {
PostQuitMessage(1);
}
PostQuitMessage(0);
break;
default:
}
return DefWindowProc(hwnd,msg,wparam,lparam);
}
```
When I run the program and close the window, the program still
runs in background mode. I don't know why this happens nor how
to fix it. Does anybody know what's going on?
More information about the Digitalmars-d-learn
mailing list