Does a modeless dialog processes WM_DESTROY Message?

Posted by Dave17 on Stack Overflow See other posts from Stack Overflow or by Dave17
Published on 2010-03-08T14:16:47Z Indexed on 2010/03/08 14:21 UTC
Read the original article Hit count: 238

I'm trying to create a modeless dialog as the main window of a program but it doesn't seem to respond WM_DESTROY or WM_NCDESTROY Message.

HWND hwnd=CreateDialogParamA(hInst,MAKEINTRESOURCE(IDD_DIALOG1),0,DialogProc,LPARAM(this));

if (!hwnd)
{
    MessageBox(0, "Failed to create wnd", 0, 0);
    return NULL;
}

ShowWindow(hwnd,nCmd); 
UpdateWindow(hwnd);

while (GetMessage (&msg, NULL, 0, 0) > 0)
{
    if (!IsWindow(hwnd) || !IsDialogMessage(hwnd,&msg))
    {
        TranslateMessage (&msg) ;
        DispatchMessage (&msg) ;
    }
}

Modeless Style format from Resource file

STYLE DS_SETFONT | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU

© Stack Overflow or respective owner

Related posts about pure-win32

Related posts about winapi