00466 {
00467 HWND hwnd =
HWq(pwnd);
00468
TL tlpwndT1, tlpwndT2, tlpwndT3, tlpwndTop;
00469
PWND pwndT;
00470
PWND pwndT1, pwndT2, pwndT3, pwndTop;
00471 HWND hwndT1;
00472 LRESULT result;
00473
BOOL fSetBit;
00474 DLGPROC pfn;
00475
00476
CheckLock(pwnd);
00477
00478
00479
00480
00481
VALIDATECLASSANDSIZE(pwnd, FNID_DIALOG);
00482
00483
00484
00485
00486
if (!
ValidateDialogPwnd(pwnd))
00487
return 0;
00488
00489
if (((
PDIALOG)pwnd)->resultWP != 0)
00490
NtUserSetWindowLongPtr(hwnd, DWLP_MSGRESULT, 0, FALSE);
00491 result = 0;
00492
00493
if (message == WM_FINALDESTROY) {
00494
goto DoCleanup;
00495 }
00496
00497
if ((pfn =
PDLG(pwnd)->lpfnDlg) !=
NULL) {
00498
00499
00500
00501
00502
00503 result =
CALLPROC_WOWCHECKPWW_DLG(pfn, hwnd, message, wParam, lParam, &(pwnd->state));
00504
00505
00506
00507
00508
if ((
RevalidateHwnd(hwnd)==
NULL) || (pwnd->fnid &
FNID_STATUS_BITS))
00509
return result;
00510 }
00511
00512
00513
00514
00515
00516
00517
00518
00519
switch (message)
00520 {
00521
case WM_COMPAREITEM:
00522
case WM_VKEYTOITEM:
00523
case WM_CHARTOITEM:
00524
case WM_INITDIALOG:
00525
case WM_QUERYDRAGICON:
00526
return ((LRESULT)(
DWORD)result);
00527
00528
case WM_CTLCOLOR:
00529
case WM_CTLCOLORMSGBOX:
00530
case WM_CTLCOLOREDIT:
00531
case WM_CTLCOLORLISTBOX:
00532
case WM_CTLCOLORBTN:
00533
case WM_CTLCOLORDLG:
00534
case WM_CTLCOLORSCROLLBAR:
00535
case WM_CTLCOLORSTATIC:
00536
00537
00538
00539
00540
if (result)
00541
return result;
00542
break;
00543 }
00544
00545
if (!result) {
00546
00547
00548
00549
00550
00551
00552
00553
switch (message) {
00554
case WM_CTLCOLOR:
00555
case WM_CTLCOLORMSGBOX:
00556
case WM_CTLCOLOREDIT:
00557
case WM_CTLCOLORLISTBOX:
00558
case WM_CTLCOLORBTN:
00559
case WM_CTLCOLORDLG:
00560
case WM_CTLCOLORSCROLLBAR:
00561
case WM_CTLCOLORSTATIC:
00562 {
00563
00564
00565
00566
00567
00568
00569
00570
00571
00572 fSetBit = (
TestWF(pwnd, DF3DLOOK)!= 0) &&
00573 (
TestWF(pwnd, WFWIN40COMPAT) == 0);
00574
00575
if (fSetBit)
00576
SetWindowState(pwnd, WFWIN40COMPAT);
00577
00578 result =
DefWindowProcWorker(pwnd, message,
00579 wParam, lParam, fAnsi);
00580
00581
if (fSetBit)
00582
ClearWindowState(pwnd, WFWIN40COMPAT);
00583
return result;
00584 }
00585
00586
case WM_ERASEBKGND:
00587
FillWindow(hwnd, hwnd, (HDC)wParam, (HBRUSH)CTLCOLOR_DLG);
00588
return TRUE;
00589
00590
case WM_SHOWWINDOW:
00591
00592
00593
00594
00595
00596
00597
if (
GetParentDialog(pwnd) == pwnd) {
00598
if (!wParam) {
00599
xxxSaveDlgFocus(pwnd);
00600 }
else {
00601
00602
if (LOWORD(lParam) != 0 &&
PDLG(pwnd)->fEnd)
00603
break;
00604
00605
00606
00607
00608
00609
00610
00611
00612
00613
if (
TEST_PUSIF(PUSIF_SNAPTO) &&
00614
IsInForegroundQueue(hwnd)) {
00615 hwndT1 =
GetDlgItem(hwnd, (
int)
PDLG(pwnd)->result);
00616
if (hwndT1) {
00617 RECT rc;
00618
00619
NtUserShowCursor(FALSE);
00620
00621
GetWindowRect(hwndT1, &rc);
00622
NtUserSetCursorPos(rc.left + ((rc.right - rc.left)/2),
00623 rc.top + ((rc.bottom - rc.top)/2));
00624
00625
NtUserShowCursor(TRUE);
00626 }
00627 }
00628 }
00629 }
00630
goto CallDWP;
00631
00632
case WM_SYSCOMMAND:
00633
if (
GetParentDialog(pwnd) == pwnd) {
00634
00635
00636
00637
00638
00639
if ((
int)wParam == SC_MINIMIZE)
00640
xxxSaveDlgFocus(pwnd);
00641 }
00642
goto CallDWP;
00643
00644
case WM_ACTIVATE:
00645 pwndT1 =
GetParentDialog(pwnd);
00646
if ( pwndT1 != pwnd) {
00647
00648
00649
00650
00651
00652
00653
NtUserSetThreadState(wParam ? QF_DIALOGACTIVE : 0, QF_DIALOGACTIVE);
00654 }
00655
00656
ThreadLock(pwndT1, &tlpwndT1);
00657
if (wParam != 0)
00658
xxxRestoreDlgFocus(pwndT1);
00659
else
00660
xxxSaveDlgFocus(pwndT1);
00661
00662
ThreadUnlock(&tlpwndT1);
00663
break;
00664
00665
case WM_SETFOCUS:
00666 pwndT1 =
GetParentDialog(pwnd);
00667
if (!
PDLG(pwndT1)->fEnd && !
xxxRestoreDlgFocus(pwndT1)) {
00668
00669 pwndT =
_GetNextDlgTabItem(pwndT1, NULL, FALSE);
00670
DlgSetFocus(
HW(pwndT));
00671 }
00672
break;
00673
00674
case WM_CLOSE:
00675
00676
00677
00678
00679
00680
00681 pwndT1 =
_GetDlgItem(pwnd, IDCANCEL);
00682
if (pwndT1 &&
TestWF(pwndT1, WFDISABLED))
00683
NtUserMessageBeep(0);
00684
else
00685
PostMessage(hwnd, WM_COMMAND, MAKELONG(IDCANCEL, BN_CLICKED),
00686 (LPARAM)
HW(pwndT1));
00687
break;
00688
00689
case WM_NCDESTROY:
00690
case WM_FINALDESTROY:
00691 DoCleanup:
00692
NtUserSetThreadState(0, QF_DIALOGACTIVE);
00693
if (!(pwnd->style & DS_LOCALEDIT)) {
00694
if (
PDLG(pwnd)->hData) {
00695
ReleaseEditDS(
PDLG(pwnd)->hData);
00696
PDLG(pwnd)->hData =
NULL;
00697 }
00698 }
00699
00700
00701
00702
00703
if (
PDLG(pwnd)->hUserFont) {
00704 DeleteObject(
PDLG(pwnd)->hUserFont);
00705
PDLG(pwnd)->hUserFont =
NULL;
00706 }
00707
00708
00709
00710
00711
FreeLookasideEntry(&DialogLookaside,
PDLG(pwnd));
00712
NtUserCallHwndParam(hwnd, 0, SFI_SETDIALOGPOINTER);
00713
break;
00714
00715
case DM_REPOSITION:
00716 {
00717 RECT rc;
00718
PMONITOR pMonitor;
00719
00720
00721
00722
00723
00724
if (!
TestWF(pwnd, WEFCONTROLPARENT) ||
00725 (
GETFNID(pwnd) !=
FNID_DESKTOP &&
00726
GETFNID(
REBASEPWND(pwnd, spwndParent)) !=
FNID_DESKTOP)) {
00727
00728
goto CallDWP;
00729 }
00730
00731
CopyRect(&rc, &pwnd->
rcWindow);
00732 pMonitor =
_MonitorFromRect(&rc, MONITOR_DEFAULTTOPRIMARY);
00733
RepositionRect(pMonitor, &rc, pwnd->style, pwnd->ExStyle);
00734
NtUserSetWindowPos(hwnd, HWND_TOP, rc.left, rc.top,
00735 rc.right-rc.left, rc.bottom-rc.top,
00736 SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE);
00737 }
00738
break;
00739
00740
case DM_SETDEFID:
00741 pwndT1 =
GetParentDialog(pwnd);
00742
ThreadLock(pwndT1, &tlpwndT1);
00743
00744
if (!(
PDLG(pwndT1)->fEnd)) {
00745
00746 pwndT2 =
NULL;
00747
if (
PDLG(pwndT1)->result != 0)
00748 pwndT2 =
_FindDlgItem(pwndT1, (
int)
PDLG(pwndT1)->result);
00749
00750 pwndT3 =
NULL;
00751
if (wParam != 0) {
00752 pwndT3 =
_GetDlgItem(pwnd, (UINT)wParam);
00753 }
00754
00755
ThreadLock(pwndT2, &tlpwndT2);
00756
ThreadLock(pwndT3, &tlpwndT3);
00757
00758
xxxCheckDefPushButton(pwndT1,
HW(pwndT2),
HW(pwndT3));
00759
00760
ThreadUnlock(&tlpwndT3);
00761
ThreadUnlock(&tlpwndT2);
00762
00763
PDLG(pwndT1)->result = (
UINT)wParam;
00764
00765
00766
00767
00768
if (
FWINABLE()) {
00769
NotifyWinEvent(EVENT_OBJECT_DEFACTIONCHANGE,
HW(pwndT1), OBJID_CLIENT, INDEXID_CONTAINER);
00770 }
00771 }
00772
ThreadUnlock(&tlpwndT1);
00773
return TRUE;
00774
00775
case DM_GETDEFID:
00776 pwndT1 =
GetParentDialog(pwnd);
00777
00778
if (!
PDLG(pwndT1)->fEnd &&
PDLG(pwndT1)->result)
00779
return(MAKELONG(
PDLG(pwndT1)->result, DC_HASDEFID));
00780
else
00781
return 0;
00782
break;
00783
00784
00785
00786
00787
00788
00789
00790
case WM_NEXTDLGCTL:
00791 pwndTop =
GetParentDialog(pwnd);
00792
ThreadLock(pwndTop, &tlpwndTop);
00793
00794 hwndT1 =
GetFocus();
00795 pwndT2 =
ValidateHwndNoRip(hwndT1);
00796
if (LOWORD(lParam)) {
00797
if (pwndT2 ==
NULL)
00798 pwndT2 = pwndTop;
00799
00800
00801
00802
00803
if ((pwndT1 =
ValidateHwnd((HWND)wParam)) ==
NULL) {
00804
ThreadUnlock(&tlpwndTop);
00805
return TRUE;
00806 }
00807 }
else {
00808
if (pwndT2 ==
NULL) {
00809
00810
00811
00812
00813 pwndT1 =
_GetNextDlgTabItem(pwndTop, NULL, FALSE);
00814 pwndT2 = pwndTop;
00815 }
else {
00816
00817
00818
00819
00820
if (!
_IsChild(pwndTop, pwndT2)) {
00821
ThreadUnlock(&tlpwndTop);
00822
return TRUE;
00823 }
00824
00825
00826
00827 pwndT1 =
_GetNextDlgTabItem(pwndTop, pwndT2, (wParam != 0));
00828
00829
00830
00831
00832
if (pwndT1 ==
NULL) {
00833
ThreadUnlock(&tlpwndTop);
00834
return TRUE;
00835 }
00836 }
00837 }
00838
00839
ThreadLock(pwndT1, &tlpwndT1);
00840
ThreadLock(pwndT2, &tlpwndT2);
00841
00842
DlgSetFocus(
HW(pwndT1));
00843
xxxCheckDefPushButton(pwndTop,
HW(pwndT2),
HW(pwndT1));
00844
00845
ThreadUnlock(&tlpwndT2);
00846
ThreadUnlock(&tlpwndT1);
00847
ThreadUnlock(&tlpwndTop);
00848
00849
return TRUE;
00850
00851
case WM_ENTERMENULOOP:
00852
00853
00854
00855
00856
00857
00858
00859
00860
case WM_LBUTTONDOWN:
00861
case WM_NCLBUTTONDOWN:
00862 hwndT1 =
GetFocus();
00863
if (hwndT1 !=
NULL) {
00864 pwndT1 =
ValidateHwndNoRip(hwndT1);
00865
00866
if (
GETFNID(pwndT1) ==
FNID_COMBOBOX) {
00867
00868
00869
00870
00871
00872
00873
ThreadLockAlways(pwndT1, &tlpwndT1);
00874
SendMessage(
HWq(pwndT1), CB_SHOWDROPDOWN, FALSE, 0);
00875
ThreadUnlock(&tlpwndT1);
00876
00877 }
else {
00878
PWND pwndParent;
00879
00880
00881
00882
00883
00884
00885
00886 pwndParent =
REBASEPWND(pwndT1, spwndParent);
00887
if (
GETFNID(pwndParent) ==
FNID_COMBOBOX) {
00888 pwndT1 = pwndParent;
00889
ThreadLock(pwndT1, &tlpwndT1);
00890
SendMessage(
HWq(pwndT1), CB_SHOWDROPDOWN, FALSE, 0);
00891
ThreadUnlock(&tlpwndT1);
00892 }
00893 }
00894 }
00895
00896
00897
00898
00899
goto CallDWP;
00900
00901
case WM_GETFONT:
00902
return (LRESULT)
PDLG(pwnd)->hUserFont;
00903
00904
case WM_VKEYTOITEM:
00905
case WM_COMPAREITEM:
00906
case WM_CHARTOITEM:
00907
case WM_INITDIALOG:
00908
00909
00910
00911
00912
00913
return result;
00914
00915
case WM_NOTIFYFORMAT:
00916
if (lParam == NF_QUERY)
00917
return((
PDLG(pwnd)->flags &
DLGF_ANSI ) ? NFR_ANSI : NFR_UNICODE);
00918
return result;
00919
00920
case WM_INPUTLANGCHANGEREQUEST:
00921
if (
IS_IME_ENABLED() ||
IS_MIDEAST_ENABLED()) {
00922
00923
00924
00925
00926
00927
break;
00928 }
00929
if (
PDLG(pwnd)->lpfnDlg ==
MB_DlgProcA ||
00930
PDLG(pwnd)->lpfnDlg ==
MB_DlgProcW) {
00931
break;
00932 }
00933
goto CallDWP;
00934
00935
default:
00936 CallDWP:
00937
return DefWindowProcWorker(pwnd, message, wParam, lParam, fAnsi);
00938 }
00939 }
else if ((message == WM_SHOWWINDOW) && result) {
00940
00941
00942
00943
00944
00945
00946
if (
GetParentDialog(pwnd) == pwnd) {
00947
00948
if (wParam && ((LOWORD(lParam) == 0) || !
PDLG(pwnd)->fEnd)) {
00949
00950
00951
00952
00953
00954
00955
00956
00957
00958
if (
TEST_PUSIF(PUSIF_SNAPTO) &&
00959
IsInForegroundQueue(hwnd)) {
00960 hwndT1 =
GetDlgItem(hwnd, (
int)
PDLG(pwnd)->result);
00961
if (hwndT1) {
00962 RECT rc;
00963
00964
NtUserShowCursor(FALSE);
00965
00966
GetWindowRect(hwndT1, &rc);
00967
NtUserSetCursorPos(rc.left + ((rc.right - rc.left)/2),
00968 rc.top + ((rc.bottom - rc.top)/2));
00969
00970
NtUserShowCursor(TRUE);
00971 }
00972 }
00973 }
00974 }
00975 }
00976
00977
00978
00979
00980
00981
00982
00983
if (
TestWF(pwnd, WFDIALOGWINDOW))
00984
return KERNEL_LRESULT_TO_LRESULT(((
PDIALOG)pwnd)->resultWP);
00985
else
00986
return result;
00987 }