defdlg.c 14.7 KB
Newer Older
Alexandre Julliard's avatar
Alexandre Julliard committed
1 2 3
/*
 * Default dialog procedure
 *
Alexandre Julliard's avatar
Alexandre Julliard committed
4
 * Copyright 1993, 1996 Alexandre Julliard
Alexandre Julliard's avatar
Alexandre Julliard committed
5
 *
6 7 8 9 10 11 12 13 14 15 16 17
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
Alexandre Julliard's avatar
Alexandre Julliard committed
19
 */
Alexandre Julliard's avatar
Alexandre Julliard committed
20

21 22
#include <stdarg.h>

23
#include "windef.h"
24
#include "winbase.h"
25
#include "wingdi.h"
26
#include "winuser.h"
27
#include "controls.h"
Alexandre Julliard's avatar
Alexandre Julliard committed
28
#include "win.h"
29
#include "user_private.h"
30
#include "wine/debug.h"
31

32
WINE_DEFAULT_DEBUG_CHANNEL(dialog);
Alexandre Julliard's avatar
Alexandre Julliard committed
33

Alexandre Julliard's avatar
Alexandre Julliard committed
34

35 36 37
/***********************************************************************
 *           DEFDLG_GetDlgProc
 */
38
static DLGPROC DEFDLG_GetDlgProc( HWND hwnd )
39
{
40
    DLGPROC ret;
41 42 43 44
    WND *wndPtr = WIN_GetPtr( hwnd );

    if (!wndPtr) return 0;
    if (wndPtr == WND_OTHER_PROCESS)
45
    {
46
        ERR( "cannot get dlg proc %p from other process\n", hwnd );
47
        return 0;
48
    }
49
    ret = *(DLGPROC *)((char *)wndPtr->wExtra + DWLP_DLGPROC);
50
    WIN_ReleasePtr( wndPtr );
51 52 53
    return ret;
}

Alexandre Julliard's avatar
Alexandre Julliard committed
54 55 56 57
/***********************************************************************
 *           DEFDLG_SetFocus
 *
 * Set the focus to a control of the dialog, selecting the text if
58
 * the control is an edit dialog that has DLGC_HASSETSEL.
Alexandre Julliard's avatar
Alexandre Julliard committed
59
 */
60
static void DEFDLG_SetFocus( HWND hwndCtrl )
Alexandre Julliard's avatar
Alexandre Julliard committed
61
{
62 63
    if (SendMessageW( hwndCtrl, WM_GETDLGCODE, 0, 0 ) & DLGC_HASSETSEL)
        SendMessageW( hwndCtrl, EM_SETSEL, 0, -1 );
64
    SetFocus( hwndCtrl );
Alexandre Julliard's avatar
Alexandre Julliard committed
65 66 67 68 69 70
}


/***********************************************************************
 *           DEFDLG_SaveFocus
 */
71
static void DEFDLG_SaveFocus( HWND hwnd )
Alexandre Julliard's avatar
Alexandre Julliard committed
72
{
73
    DIALOGINFO *infoPtr;
74
    HWND hwndFocus = GetFocus();
Alexandre Julliard's avatar
Alexandre Julliard committed
75

76
    if (!hwndFocus || !IsChild( hwnd, hwndFocus )) return;
77
    if (!(infoPtr = DIALOG_get_info( hwnd, FALSE ))) return;
Alexandre Julliard's avatar
Alexandre Julliard committed
78
    infoPtr->hwndFocus = hwndFocus;
79
    /* Remove default button */
Alexandre Julliard's avatar
Alexandre Julliard committed
80 81 82 83 84 85
}


/***********************************************************************
 *           DEFDLG_RestoreFocus
 */
86
static void DEFDLG_RestoreFocus( HWND hwnd, BOOL justActivate )
Alexandre Julliard's avatar
Alexandre Julliard committed
87
{
88
    DIALOGINFO *infoPtr;
89

90
    if (IsIconic( hwnd )) return;
91
    if (!(infoPtr = DIALOG_get_info( hwnd, FALSE ))) return;
92
    /* Don't set the focus back to controls if EndDialog is already called.*/
93 94
    if (infoPtr->flags & DF_END) return;
    if (!IsWindow(infoPtr->hwndFocus) || infoPtr->hwndFocus == hwnd) {
95
        if (justActivate) return;
96 97 98
        /* If no saved focus control exists, set focus to the first visible,
           non-disabled, WS_TABSTOP control in the dialog */
        infoPtr->hwndFocus = GetNextDlgTabItem( hwnd, 0, FALSE );
99 100 101
        /* If there are no WS_TABSTOP controls, set focus to the first visible,
           non-disabled control in the dialog */
        if (!infoPtr->hwndFocus) infoPtr->hwndFocus = GetNextDlgGroupItem( hwnd, 0, FALSE );
102
        if (!IsWindow( infoPtr->hwndFocus )) return;
103
    }
104 105 106 107
    if (justActivate)
        SetFocus( infoPtr->hwndFocus );
    else
        DEFDLG_SetFocus( infoPtr->hwndFocus );
108
    infoPtr->hwndFocus = NULL;
Alexandre Julliard's avatar
Alexandre Julliard committed
109 110 111 112 113 114 115 116
}


/***********************************************************************
 *           DEFDLG_FindDefButton
 *
 * Find the current default push-button.
 */
117
static HWND DEFDLG_FindDefButton( HWND hwndDlg )
Alexandre Julliard's avatar
Alexandre Julliard committed
118
{
119 120 121
    HWND hwndChild, hwndTmp;

    hwndChild = GetWindow( hwndDlg, GW_CHILD );
Alexandre Julliard's avatar
Alexandre Julliard committed
122 123
    while (hwndChild)
    {
124
        if (SendMessageW( hwndChild, WM_GETDLGCODE, 0, 0 ) & DLGC_DEFPUSHBUTTON)
Alexandre Julliard's avatar
Alexandre Julliard committed
125
            break;
126 127

        /* Recurse into WS_EX_CONTROLPARENT controls */
128
        if (GetWindowLongW( hwndChild, GWL_EXSTYLE ) & WS_EX_CONTROLPARENT)
129
        {
130
            LONG dsStyle = GetWindowLongW( hwndChild, GWL_STYLE );
131 132 133 134
            if ((dsStyle & WS_VISIBLE) && !(dsStyle & WS_DISABLED) &&
                (hwndTmp = DEFDLG_FindDefButton(hwndChild)) != NULL)
           return hwndTmp;
        }
135
        hwndChild = GetWindow( hwndChild, GW_HWNDNEXT );
Alexandre Julliard's avatar
Alexandre Julliard committed
136 137 138 139 140 141
    }
    return hwndChild;
}


/***********************************************************************
142
 *           DEFDLG_SetDefId
Alexandre Julliard's avatar
Alexandre Julliard committed
143
 *
144
 * Set the default button id.
Alexandre Julliard's avatar
Alexandre Julliard committed
145
 */
146
static BOOL DEFDLG_SetDefId( HWND hwndDlg, DIALOGINFO *dlgInfo, WPARAM wParam)
Alexandre Julliard's avatar
Alexandre Julliard committed
147
{
148
    DWORD dlgcode=0; /* initialize just to avoid a warning */
149 150
    HWND hwndOld, hwndNew = GetDlgItem(hwndDlg, wParam);
    INT old_id = dlgInfo->idResult;
151 152

    dlgInfo->idResult = wParam;
Alexandre Julliard's avatar
Alexandre Julliard committed
153
    if (hwndNew &&
154
        !((dlgcode=SendMessageW(hwndNew, WM_GETDLGCODE, 0, 0 ))
155
            & (DLGC_UNDEFPUSHBUTTON | DLGC_BUTTON)))
Alexandre Julliard's avatar
Alexandre Julliard committed
156
        return FALSE;  /* Destination is not a push button */
157

158 159
    /* Make sure the old default control is a valid push button ID */
    hwndOld = GetDlgItem( hwndDlg, old_id );
160
    if (!hwndOld || !(SendMessageW( hwndOld, WM_GETDLGCODE, 0, 0) & DLGC_DEFPUSHBUTTON))
161 162
        hwndOld = DEFDLG_FindDefButton( hwndDlg );
    if (hwndOld && hwndOld != hwndNew)
163
        SendMessageW( hwndOld, BM_SETSTYLE, BS_PUSHBUTTON, TRUE );
164 165

    if (hwndNew)
Alexandre Julliard's avatar
Alexandre Julliard committed
166
    {
167
        if(dlgcode & DLGC_UNDEFPUSHBUTTON)
168
            SendMessageW( hwndNew, BM_SETSTYLE, BS_DEFPUSHBUTTON, TRUE );
Alexandre Julliard's avatar
Alexandre Julliard committed
169
    }
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197
    return TRUE;
}


/***********************************************************************
 *           DEFDLG_SetDefButton
 *
 * Set the new default button to be hwndNew.
 */
static BOOL DEFDLG_SetDefButton( HWND hwndDlg, DIALOGINFO *dlgInfo, HWND hwndNew )
{
    DWORD dlgcode=0; /* initialize just to avoid a warning */
    HWND hwndOld = GetDlgItem( hwndDlg, dlgInfo->idResult );

    if (hwndNew &&
        !((dlgcode=SendMessageW(hwndNew, WM_GETDLGCODE, 0, 0 ))
            & (DLGC_UNDEFPUSHBUTTON | DLGC_DEFPUSHBUTTON)))
    {
        /**
         * Need to draw only default push button rectangle.
         * Since the next control is not a push button, need to draw the push
         * button rectangle for the default control.
         */
        hwndNew = hwndOld;
        dlgcode = SendMessageW(hwndNew, WM_GETDLGCODE, 0, 0 );
    }

    /* Make sure the old default control is a valid push button ID */
198
    if (!hwndOld || !(SendMessageW( hwndOld, WM_GETDLGCODE, 0, 0) & DLGC_DEFPUSHBUTTON))
199 200
        hwndOld = DEFDLG_FindDefButton( hwndDlg );
    if (hwndOld && hwndOld != hwndNew)
201
        SendMessageW( hwndOld, BM_SETSTYLE, BS_PUSHBUTTON, TRUE );
202

Alexandre Julliard's avatar
Alexandre Julliard committed
203 204
    if (hwndNew)
    {
205
        if(dlgcode & DLGC_UNDEFPUSHBUTTON)
206
            SendMessageW( hwndNew, BM_SETSTYLE, BS_DEFPUSHBUTTON, TRUE );
Alexandre Julliard's avatar
Alexandre Julliard committed
207 208 209
    }
    return TRUE;
}
Alexandre Julliard's avatar
Alexandre Julliard committed
210 211 212


/***********************************************************************
Alexandre Julliard's avatar
Alexandre Julliard committed
213 214 215 216
 *           DEFDLG_Proc
 *
 * Implementation of DefDlgProc(). Only handle messages that need special
 * handling for dialogs.
Alexandre Julliard's avatar
Alexandre Julliard committed
217
 */
218
static LRESULT DEFDLG_Proc( HWND hwnd, UINT msg, WPARAM wParam,
Alexandre Julliard's avatar
Alexandre Julliard committed
219
                            LPARAM lParam, DIALOGINFO *dlgInfo )
Alexandre Julliard's avatar
Alexandre Julliard committed
220
{
Alexandre Julliard's avatar
Alexandre Julliard committed
221
    switch(msg)
Alexandre Julliard's avatar
Alexandre Julliard committed
222 223
    {
        case WM_ERASEBKGND:
224
        {
225 226
            HBRUSH brush = (HBRUSH)SendMessageW( hwnd, WM_CTLCOLORDLG, wParam, (LPARAM)hwnd );
            if (!brush) brush = (HBRUSH)DefWindowProcW( hwnd, WM_CTLCOLORDLG, wParam, (LPARAM)hwnd );
227 228 229 230 231 232 233 234 235 236
            if (brush)
            {
                RECT rect;
                HDC hdc = (HDC)wParam;
                GetClientRect( hwnd, &rect );
                DPtoLP( hdc, (LPPOINT)&rect, 2 );
                FillRect( hdc, &rect, brush );
            }
            return 1;
        }
237
        case WM_NCDESTROY:
238
            if (dlgInfo)
239
            {
240 241
                WND *wndPtr;

242 243 244
                if (dlgInfo->hUserFont) DeleteObject( dlgInfo->hUserFont );
                if (dlgInfo->hMenu) DestroyMenu( dlgInfo->hMenu );
                HeapFree( GetProcessHeap(), 0, dlgInfo );
245 246 247 248

                wndPtr = WIN_GetPtr( hwnd );
                wndPtr->dlgInfo = NULL;
                WIN_ReleasePtr( wndPtr );
249
            }
250 251
              /* Window clean-up */
            return DefWindowProcA( hwnd, msg, wParam, lParam );
Alexandre Julliard's avatar
Alexandre Julliard committed
252

253 254 255
        case WM_SHOWWINDOW:
            if (!wParam) DEFDLG_SaveFocus( hwnd );
            return DefWindowProcA( hwnd, msg, wParam, lParam );
Alexandre Julliard's avatar
Alexandre Julliard committed
256

257
        case WM_ACTIVATE:
258
            if (wParam) DEFDLG_RestoreFocus( hwnd, TRUE );
259 260
            else DEFDLG_SaveFocus( hwnd );
            return 0;
Alexandre Julliard's avatar
Alexandre Julliard committed
261

262
        case WM_SETFOCUS:
263
            DEFDLG_RestoreFocus( hwnd, FALSE );
264
            return 0;
Alexandre Julliard's avatar
Alexandre Julliard committed
265 266

        case DM_SETDEFID:
267
            if (dlgInfo && !(dlgInfo->flags & DF_END))
268
                DEFDLG_SetDefId( hwnd, dlgInfo, wParam );
Alexandre Julliard's avatar
Alexandre Julliard committed
269
            return 1;
Alexandre Julliard's avatar
Alexandre Julliard committed
270 271

        case DM_GETDEFID:
272
            if (dlgInfo && !(dlgInfo->flags & DF_END))
Alexandre Julliard's avatar
Alexandre Julliard committed
273
            {
274
                HWND hwndDefId;
Alexandre Julliard's avatar
Alexandre Julliard committed
275 276 277
                if (dlgInfo->idResult)
                    return MAKELONG( dlgInfo->idResult, DC_HASDEFID );
                if ((hwndDefId = DEFDLG_FindDefButton( hwnd )))
278
                    return MAKELONG( GetDlgCtrlID( hwndDefId ), DC_HASDEFID);
Alexandre Julliard's avatar
Alexandre Julliard committed
279
            }
280
            return 0;
Alexandre Julliard's avatar
Alexandre Julliard committed
281

282
        case WM_NEXTDLGCTL:
283 284
            if (dlgInfo)
            {
285
                HWND hwndDest = (HWND)wParam;
Alexandre Julliard's avatar
Alexandre Julliard committed
286
                if (!lParam)
287
                    hwndDest = GetNextDlgTabItem(hwnd, GetFocus(), wParam);
288
                if (hwndDest) DEFDLG_SetFocus( hwndDest );
289
                DEFDLG_SetDefButton( hwnd, dlgInfo, hwndDest );
Alexandre Julliard's avatar
Alexandre Julliard committed
290
            }
Alexandre Julliard's avatar
Alexandre Julliard committed
291
            return 0;
Alexandre Julliard's avatar
Alexandre Julliard committed
292

Alexandre Julliard's avatar
Alexandre Julliard committed
293 294 295 296
        case WM_ENTERMENULOOP:
        case WM_LBUTTONDOWN:
        case WM_NCLBUTTONDOWN:
            {
297
                HWND hwndFocus = GetFocus();
Alexandre Julliard's avatar
Alexandre Julliard committed
298 299
                if (hwndFocus)
                {
300
                    /* always make combo box hide its listbox control */
301 302
                    if (!SendMessageW( hwndFocus, CB_SHOWDROPDOWN, FALSE, 0 ))
                        SendMessageW( GetParent(hwndFocus), CB_SHOWDROPDOWN, FALSE, 0 );
Alexandre Julliard's avatar
Alexandre Julliard committed
303 304
                }
            }
305
            return DefWindowProcA( hwnd, msg, wParam, lParam );
Alexandre Julliard's avatar
Alexandre Julliard committed
306

307
        case WM_GETFONT:
308
            return dlgInfo ? (LRESULT)dlgInfo->hUserFont : 0;
Alexandre Julliard's avatar
Alexandre Julliard committed
309

Alexandre Julliard's avatar
Alexandre Julliard committed
310
        case WM_CLOSE:
311
            PostMessageA( hwnd, WM_COMMAND, MAKEWPARAM(IDCANCEL, BN_CLICKED),
312
                            (LPARAM)GetDlgItem( hwnd, IDCANCEL ) );
Alexandre Julliard's avatar
Alexandre Julliard committed
313
            return 0;
Alexandre Julliard's avatar
Alexandre Julliard committed
314 315 316 317
    }
    return 0;
}

318
/***********************************************************************
319
*               DIALOG_get_info
320
*
321 322
* Get the DIALOGINFO structure of a window, allocating it if needed
* and 'create' is TRUE.
323
*/
324
DIALOGINFO *DIALOG_get_info( HWND hwnd, BOOL create )
325 326
{
    WND* wndPtr;
327
    DIALOGINFO* dlgInfo;
328

329 330
    wndPtr = WIN_GetPtr( hwnd );
    if (!wndPtr || wndPtr == WND_OTHER_PROCESS || wndPtr == WND_DESKTOP)
331 332
    {
        SetLastError( ERROR_INVALID_WINDOW_HANDLE );
333
        return NULL;
334
    }
335 336 337 338

    dlgInfo = wndPtr->dlgInfo;

    if (!dlgInfo && create)
339
    {
340 341
        if (!(dlgInfo = HeapAlloc( GetProcessHeap(), 0, sizeof(*dlgInfo) )))
            goto out;
342 343 344 345 346
        dlgInfo->hwndFocus   = 0;
        dlgInfo->hUserFont   = 0;
        dlgInfo->hMenu       = 0;
        dlgInfo->xBaseUnit   = 0;
        dlgInfo->yBaseUnit   = 0;
347
        dlgInfo->idResult    = IDOK;
348
        dlgInfo->flags       = 0;
349
        wndPtr->dlgInfo = dlgInfo;
350
    }
351 352 353

out:
    WIN_ReleasePtr( wndPtr );
354 355 356
    return dlgInfo;
}

Alexandre Julliard's avatar
Alexandre Julliard committed
357
/***********************************************************************
358
 *              DefDlgProcA (USER32.@)
Alexandre Julliard's avatar
Alexandre Julliard committed
359
 */
360
LRESULT WINAPI DefDlgProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
Alexandre Julliard's avatar
Alexandre Julliard committed
361
{
362
    DIALOGINFO *dlgInfo;
363
    DLGPROC dlgproc;
364
    LRESULT result = 0;
365

366
    /* Perform DIALOGINFO initialization if not done */
367
    if(!(dlgInfo = DIALOG_get_info( hwnd, TRUE ))) return 0;
368

369
    SetWindowLongPtrW( hwnd, DWLP_MSGRESULT, 0 );
Alexandre Julliard's avatar
Alexandre Julliard committed
370

371 372
    if ((dlgproc = DEFDLG_GetDlgProc( hwnd ))) /* Call dialog procedure */
        result = WINPROC_CallDlgProcA( dlgproc, hwnd, msg, wParam, lParam );
Alexandre Julliard's avatar
Alexandre Julliard committed
373

374
    if (!result && IsWindow(hwnd))
Alexandre Julliard's avatar
Alexandre Julliard committed
375
    {
Alexandre Julliard's avatar
Alexandre Julliard committed
376 377 378 379 380 381 382 383 384 385 386 387 388 389
        /* callback didn't process this message */

        switch(msg)
        {
            case WM_ERASEBKGND:
            case WM_SHOWWINDOW:
            case WM_ACTIVATE:
            case WM_SETFOCUS:
            case DM_SETDEFID:
            case DM_GETDEFID:
            case WM_NEXTDLGCTL:
            case WM_GETFONT:
            case WM_CLOSE:
            case WM_NCDESTROY:
Alexandre Julliard's avatar
Alexandre Julliard committed
390 391 392
            case WM_ENTERMENULOOP:
            case WM_LBUTTONDOWN:
            case WM_NCLBUTTONDOWN:
393
                 return DEFDLG_Proc( hwnd, msg, wParam, lParam, dlgInfo );
Alexandre Julliard's avatar
Alexandre Julliard committed
394 395 396 397 398 399 400
            case WM_INITDIALOG:
            case WM_VKEYTOITEM:
            case WM_COMPAREITEM:
            case WM_CHARTOITEM:
                 break;

            default:
401
                 return DefWindowProcA( hwnd, msg, wParam, lParam );
Alexandre Julliard's avatar
Alexandre Julliard committed
402
        }
Alexandre Julliard's avatar
Alexandre Julliard committed
403
    }
404 405 406 407 408 409 410 411

    if ((msg >= WM_CTLCOLORMSGBOX && msg <= WM_CTLCOLORSTATIC) ||
         msg == WM_CTLCOLOR || msg == WM_COMPAREITEM ||
         msg == WM_VKEYTOITEM || msg == WM_CHARTOITEM ||
         msg == WM_QUERYDRAGICON || msg == WM_INITDIALOG)
        return result;

    return GetWindowLongPtrW( hwnd, DWLP_MSGRESULT );
Alexandre Julliard's avatar
Alexandre Julliard committed
412 413 414 415
}


/***********************************************************************
416
 *              DefDlgProcW (USER32.@)
Alexandre Julliard's avatar
Alexandre Julliard committed
417
 */
418
LRESULT WINAPI DefDlgProcW( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
Alexandre Julliard's avatar
Alexandre Julliard committed
419
{
420
    DIALOGINFO *dlgInfo;
421
    DLGPROC dlgproc;
422
    LRESULT result = 0;
423

424
    /* Perform DIALOGINFO initialization if not done */
425
    if(!(dlgInfo = DIALOG_get_info( hwnd, TRUE ))) return 0;
426

427
    SetWindowLongPtrW( hwnd, DWLP_MSGRESULT, 0 );
Alexandre Julliard's avatar
Alexandre Julliard committed
428

429 430
    if ((dlgproc = DEFDLG_GetDlgProc( hwnd ))) /* Call dialog procedure */
        result = WINPROC_CallDlgProcW( dlgproc, hwnd, msg, wParam, lParam );
Alexandre Julliard's avatar
Alexandre Julliard committed
431

432
    if (!result && IsWindow(hwnd))
Alexandre Julliard's avatar
Alexandre Julliard committed
433
    {
Alexandre Julliard's avatar
Alexandre Julliard committed
434 435 436 437 438 439 440 441 442 443 444 445 446 447
        /* callback didn't process this message */

        switch(msg)
        {
            case WM_ERASEBKGND:
            case WM_SHOWWINDOW:
            case WM_ACTIVATE:
            case WM_SETFOCUS:
            case DM_SETDEFID:
            case DM_GETDEFID:
            case WM_NEXTDLGCTL:
            case WM_GETFONT:
            case WM_CLOSE:
            case WM_NCDESTROY:
Alexandre Julliard's avatar
Alexandre Julliard committed
448 449 450
            case WM_ENTERMENULOOP:
            case WM_LBUTTONDOWN:
            case WM_NCLBUTTONDOWN:
451
                 return DEFDLG_Proc( hwnd, msg, wParam, lParam, dlgInfo );
Alexandre Julliard's avatar
Alexandre Julliard committed
452 453 454 455 456 457 458
            case WM_INITDIALOG:
            case WM_VKEYTOITEM:
            case WM_COMPAREITEM:
            case WM_CHARTOITEM:
                 break;

            default:
459
                 return DefWindowProcW( hwnd, msg, wParam, lParam );
Alexandre Julliard's avatar
Alexandre Julliard committed
460
        }
Alexandre Julliard's avatar
Alexandre Julliard committed
461
    }
462 463 464 465 466 467 468 469

    if ((msg >= WM_CTLCOLORMSGBOX && msg <= WM_CTLCOLORSTATIC) ||
         msg == WM_CTLCOLOR || msg == WM_COMPAREITEM ||
         msg == WM_VKEYTOITEM || msg == WM_CHARTOITEM ||
         msg == WM_QUERYDRAGICON || msg == WM_INITDIALOG)
        return result;

    return GetWindowLongPtrW( hwnd, DWLP_MSGRESULT );
Alexandre Julliard's avatar
Alexandre Julliard committed
470
}