00320 {
00321
PWND pwndDlg;
00322
PWND pwnd;
00323
PWND pwnd2;
00324 HWND hwnd2;
00325 HWND hwndFocus;
00326
int iOK;
00327
BOOL fBack;
00328
UINT code;
00329 LONG lT;
00330
TL tlpwnd;
00331
TL tlpwndDlg;
00332
BOOL fLockDlg =
FALSE;
00333
TL tlpwnd2;
00334 WORD langID;
00335
00336 langID = PRIMARYLANGID(LANGIDFROMLCID(GetUserDefaultLCID()));
00337
00338
if ((pwndDlg =
ValidateHwndNoRip(hwndDlg)) ==
NULL) {
00339
return FALSE;
00340 }
00341
00342
CheckLock(pwndDlg);
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353
if (
TESTSYNCONLYMESSAGE(lpMsg->message, lpMsg->wParam)) {
00354
00355
00356
00357
if (!(
GetClientInfo()->dwTIFlags &
TIF_16BIT)) {
00358 RIPERR0(ERROR_MESSAGE_SYNC_ONLY, RIP_WARNING,
"IsDialogMessage: must be sync only");
00359
return FALSE;
00360 }
00361
00362
00363
00364
00365
00366
00367
00368 lpMsg->message |=
MSGFLAG_WOW_RESERVED;
00369 }
00370
00371
if (
CallMsgFilter(lpMsg, MSGF_DIALOGBOX))
00372
return TRUE;
00373
00374
if (lpMsg->hwnd ==
NULL) {
00375
return FALSE;
00376 }
00377
00378 pwnd =
ValidateHwnd(lpMsg->hwnd);
00379
00380
00381
00382
00383
00384
00385
00386
if (
TestWF(pwndDlg, WEFCONTROLPARENT) &&
TestWF(pwndDlg, WFCHILD)) {
00387 pwndDlg =
GetParentDialog(pwndDlg);
00388
ThreadLock(pwndDlg, &tlpwndDlg);
00389 fLockDlg =
TRUE;
00390 hwndDlg =
HWq(pwndDlg);
00391 }
00392
00393
if (pwnd != pwndDlg && !
_IsChild(pwndDlg, pwnd)) {
00394
if (fLockDlg)
00395
ThreadUnlock(&tlpwndDlg);
00396
return FALSE;
00397 }
00398
ThreadLock(pwnd, &tlpwnd);
00399
00400 fBack =
FALSE;
00401 iOK = IDCANCEL;
00402
switch (lpMsg->message) {
00403
case WM_LBUTTONDOWN:
00404
00405
00406
00407
00408
00409
if ((pwnd != pwndDlg) && ((hwndFocus =
GetFocus()) !=
NULL)) {
00410
xxxCheckDefPushButton(pwndDlg, hwndFocus, lpMsg->hwnd);
00411 }
00412
break;
00413
00414
case WM_SYSCHAR:
00415
00416
00417
00418
00419
if ((
GetFocus() ==
NULL) && (
GetKeyState(VK_MENU) >= 0)) {
00420
if (lpMsg->wParam == VK_RETURN &&
TestWF(pwnd, WFMINIMIZED)) {
00421
00422
00423
00424
00425
00426
00427
00428
goto CallDefWindowProcAndReturnTrue;
00429 }
else {
00430
NtUserMessageBeep(0);
00431 }
00432
00433
ThreadUnlock(&tlpwnd);
00434
if (fLockDlg)
00435
ThreadUnlock(&tlpwndDlg);
00436
return TRUE;
00437 }
00438
00439
00440
00441
00442
if (lpMsg->wParam ==
MENUSYSMENU) {
00443
DefWindowProcWorker(pwndDlg, lpMsg->message, lpMsg->wParam,
00444 lpMsg->lParam, FALSE);
00445
ThreadUnlock(&tlpwnd);
00446
if (fLockDlg)
00447
ThreadUnlock(&tlpwndDlg);
00448
return TRUE;
00449 }
00450
00451
00452
00453
00454
00455
case WM_CHAR:
00456
00457
00458
00459
00460
if (pwnd == pwndDlg) {
00461
ThreadUnlock(&tlpwnd);
00462
if (fLockDlg)
00463
ThreadUnlock(&tlpwndDlg);
00464
return TRUE;
00465 }
00466
00467 code = (
UINT)
SendMessage(lpMsg->hwnd, WM_GETDLGCODE, lpMsg->wParam,
00468 (LPARAM)lpMsg);
00469
00470
00471
00472
00473
00474
if ((lpMsg->message == WM_CHAR) && (code & (DLGC_WANTCHARS | DLGC_WANTMESSAGE)))
00475
break;
00476
00477
00478
00479
if ((lpMsg->wParam == VK_TAB) && (code & DLGC_WANTTAB))
00480
break;
00481
00482
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493
00494
00495
00496
if (lpMsg->wParam == VK_SPACE) {
00497
ThreadUnlock(&tlpwnd);
00498
if (fLockDlg)
00499
ThreadUnlock(&tlpwndDlg);
00500
return TRUE;
00501 }
00502
00503
if (!(pwnd2 =
xxxGotoNextMnem(pwndDlg, pwnd, (WCHAR)lpMsg->wParam))) {
00504
00505
if (code & DLGC_WANTMESSAGE)
00506
break;
00507
00508
00509
00510
00511
00512
00513
if (lpMsg->message == WM_SYSCHAR) {
00514 CallDefWindowProcAndReturnTrue:
00515
DefWindowProcWorker(pwndDlg, lpMsg->message, lpMsg->wParam,
00516 lpMsg->lParam, FALSE);
00517
00518
ThreadUnlock(&tlpwnd);
00519
if (fLockDlg)
00520
ThreadUnlock(&tlpwndDlg);
00521
return TRUE;
00522 }
00523
NtUserMessageBeep(0);
00524 }
else {
00525
00526
00527
00528
00529
00530
00531
if (pwnd2 != (
PWND)1) {
00532
ThreadLockAlways(pwnd2, &tlpwnd2);
00533
xxxCheckDefPushButton(pwndDlg, lpMsg->hwnd,
HWq(pwnd2));
00534
ThreadUnlock(&tlpwnd2);
00535 }
00536 }
00537
00538
ThreadUnlock(&tlpwnd);
00539
if (fLockDlg)
00540
ThreadUnlock(&tlpwndDlg);
00541
return TRUE;
00542
00543
case WM_SYSKEYDOWN:
00544
00545
00546
00547
if ((HIWORD(lpMsg->lParam) &
SYS_ALTERNATE) &&
TEST_KbdCuesPUSIF) {
00548
if (
TestWF(pwnd, WEFPUIFOCUSHIDDEN) || (
TestWF(pwnd, WEFPUIACCELHIDDEN))) {
00549
SendMessageWorker(pwndDlg, WM_CHANGEUISTATE,
00550 MAKEWPARAM(UIS_CLEAR, UISF_HIDEACCEL | UISF_HIDEFOCUS), 0, FALSE);
00551 }
00552 }
00553
break;
00554
00555
case WM_KEYDOWN:
00556 code = (
UINT)
SendMessage(lpMsg->hwnd, WM_GETDLGCODE, lpMsg->wParam,
00557 (LPARAM)lpMsg);
00558
if (code & (DLGC_WANTALLKEYS | DLGC_WANTMESSAGE))
00559
break;
00560
00561
switch (lpMsg->wParam) {
00562
case VK_TAB:
00563
if (code & DLGC_WANTTAB)
00564
break;
00565 pwnd2 =
_GetNextDlgTabItem(pwndDlg, pwnd,
00566 (
GetKeyState(VK_SHIFT) & 0x8000));
00567
00568
if (
TEST_KbdCuesPUSIF) {
00569
if (
TestWF(pwnd, WEFPUIFOCUSHIDDEN)) {
00570
SendMessageWorker(pwndDlg, WM_CHANGEUISTATE,
00571 MAKEWPARAM(UIS_CLEAR, UISF_HIDEFOCUS), 0, FALSE);
00572 }
00573 }
00574
00575
if (pwnd2 !=
NULL) {
00576 hwnd2 =
HWq(pwnd2);
00577
ThreadLockAlways(pwnd2, &tlpwnd2);
00578
DlgSetFocus(hwnd2);
00579
xxxCheckDefPushButton(pwndDlg, lpMsg->hwnd, hwnd2);
00580
ThreadUnlock(&tlpwnd2);
00581 }
00582
ThreadUnlock(&tlpwnd);
00583
if (fLockDlg)
00584
ThreadUnlock(&tlpwndDlg);
00585
return TRUE;
00586
00587
00588
00589
00590
00591
case VK_LEFT:
00592
if ((((langID == LANG_ARABIC) || (langID == LANG_HEBREW)) &&
TestWF(pwndDlg,WEFRTLREADING))
00593
#ifdef USE_MIRRORING
00594
^ (!!
TestWF(pwndDlg, WEFLAYOUTRTL))
00595
#endif
00596
)
00597
goto DoKeyStuff;
00598
case VK_UP:
00599 fBack =
TRUE;
00600
goto DoKeyStuff;
00601
00602
00603
00604
00605
case VK_RIGHT:
00606
if ((((langID == LANG_ARABIC) || (langID == LANG_HEBREW)) &&
TestWF(pwndDlg,WEFRTLREADING))
00607
#ifdef USE_MIRRORING
00608
^ (!!
TestWF(pwndDlg, WEFLAYOUTRTL))
00609
#endif
00610
)
00611 fBack =
TRUE;
00612
case VK_DOWN:
00613 DoKeyStuff:
00614
if (code & DLGC_WANTARROWS)
00615
break;
00616
00617
if (
TEST_KbdCuesPUSIF) {
00618
if (
TestWF(pwnd, WEFPUIFOCUSHIDDEN)) {
00619
SendMessageWorker(pwndDlg, WM_CHANGEUISTATE,
00620 MAKEWPARAM(UIS_CLEAR, UISF_HIDEFOCUS), 0, FALSE);
00621 }
00622 }
00623
00624 pwnd2 =
_GetNextDlgGroupItem(pwndDlg, pwnd, fBack);
00625
if (pwnd2 ==
NULL) {
00626
ThreadUnlock(&tlpwnd);
00627
if (fLockDlg)
00628
ThreadUnlock(&tlpwndDlg);
00629
return TRUE;
00630 }
00631 hwnd2 =
HWq(pwnd2);
00632
ThreadLockAlways(pwnd2, &tlpwnd2);
00633
00634 code = (
UINT)
SendMessage(hwnd2, WM_GETDLGCODE, lpMsg->wParam,
00635 (LPARAM)lpMsg);
00636
00637
00638
00639
00640
00641
00642
if (code & (DLGC_UNDEFPUSHBUTTON | DLGC_DEFPUSHBUTTON)) {
00643
PBUTN pbutn;
00644
BOOL fIsNTButton = (
GETFNID(pwnd2) ==
FNID_BUTTON);
00645
if (fIsNTButton) {
00646 pbutn = ((
PBUTNWND)pwnd2)->pbutn;
00647
BUTTONSTATE(pbutn) |=
BST_DONTCLICK;
00648 }
00649
DlgSetFocus(hwnd2);
00650
if (fIsNTButton) {
00651
BUTTONSTATE(pbutn) &= ~
BST_DONTCLICK;
00652 }
00653
xxxCheckDefPushButton(pwndDlg, lpMsg->hwnd, hwnd2);
00654 }
else if (code & DLGC_RADIOBUTTON) {
00655
DlgSetFocus(hwnd2);
00656
xxxCheckDefPushButton(pwndDlg, lpMsg->hwnd, hwnd2);
00657
if (
TestWF(pwnd2, BFTYPEMASK) ==
LOBYTE(BS_AUTORADIOBUTTON)) {
00658
00659
00660
00661
00662
if (!
SendMessage(hwnd2, BM_GETCHECK, 0, 0L)) {
00663
SendMessage(hwnd2, BM_CLICK, TRUE, 0L);
00664 }
00665 }
00666 }
else if (!(code & DLGC_STATIC)) {
00667
DlgSetFocus(hwnd2);
00668
xxxCheckDefPushButton(pwndDlg, lpMsg->hwnd, hwnd2);
00669 }
00670
ThreadUnlock(&tlpwnd2);
00671
ThreadUnlock(&tlpwnd);
00672
if (fLockDlg)
00673
ThreadUnlock(&tlpwndDlg);
00674
return TRUE;
00675
00676
case VK_EXECUTE:
00677
case VK_RETURN:
00678
00679
00680
00681
00682
00683
00684
if (!(hwndFocus =
GetFocus()))
00685 code = 0;
00686
else
00687 {
00688 code = (WORD)(
DWORD)
SendMessage(hwndFocus, WM_GETDLGCODE,
00689 0, 0L);
00690 }
00691
00692
if (code & DLGC_DEFPUSHBUTTON)
00693 {
00694 iOK =
GetDlgCtrlID(hwndFocus);
00695 pwnd2 =
ValidateHwnd(hwndFocus);
00696
goto HaveWindow;
00697 }
00698
else
00699 {
00700 lT = (LONG)
SendMessage(hwndDlg, DM_GETDEFID, 0, 0L);
00701 iOK = MAKELONG(
00702 (HIWORD(lT)==DC_HASDEFID ? LOWORD(lT) : IDOK),
00703 0);
00704 }
00705
00706
00707
case VK_ESCAPE:
00708
case VK_CANCEL:
00709
00710
00711
00712
00713 pwnd2 =
_FindDlgItem(pwndDlg, iOK);
00714 HaveWindow:
00715
if (pwnd2 !=
NULL &&
TestWF(pwnd2, WFDISABLED)) {
00716
NtUserMessageBeep(0);
00717 }
else {
00718
SendMessage(hwndDlg, WM_COMMAND,
00719 MAKELONG(iOK, BN_CLICKED), (LPARAM)
HW(pwnd2));
00720 }
00721
00722
ThreadUnlock(&tlpwnd);
00723
if (fLockDlg)
00724
ThreadUnlock(&tlpwndDlg);
00725
return TRUE;
00726 }
00727
break;
00728 }
00729
00730
ThreadUnlock(&tlpwnd);
00731
if (fLockDlg)
00732
ThreadUnlock(&tlpwndDlg);
00733
00734
TranslateMessage(lpMsg);
00735
DispatchMessage(lpMsg);
00736
00737
return TRUE;
00738 }