00421 {
00422 HWND hwnd;
00423 HWND hwnd2;
00424
PWND pwnd;
00425 HWND hwndNewFocus;
00426 HWND hwndEditFirst =
NULL;
00427 RECT rc;
00428 WORD w;
00429
UTCHAR *lpszMenu,
00430 *lpszClass,
00431 *lpszText,
00432 *lpCreateParams,
00433 *lpStr;
00434
int cxChar,
00435 cyChar;
00436
BOOL f40Compat;
00437 HFONT hNewFont =
NULL;
00438 HFONT hOldFont;
00439 LPDLGITEMTEMPLATE lpdit;
00440 HMENU hMenu;
00441
BOOL fSuccess;
00442
BOOL fWowWindow;
00443 HANDLE hmodCreate;
00444 LPBYTE lpCreateParamsData;
00445 DLGTEMPLATE2
dt;
00446 DLGITEMTEMPLATE2 dit;
00447
DWORD dwExpWinVer;
00448
DWORD dsStyleOld;
00449
DWORD bFlags = 0;
00450 HDC hdcDlg;
00451
LARGE_STRING strClassName;
00452
PLARGE_STRING pstrClassName;
00453
LARGE_STRING strWindowName;
00454
PMONITOR pMonitor;
00455
00456
BOOL bResizeMe=
FALSE;
00457
00458 UNREFERENCED_PARAMETER(cb);
00459
00460
ConnectIfNecessary();
00461
00462 UserAssert(!(fSCDLGFlags & ~(SCDLG_CLIENT|SCDLG_ANSI|SCDLG_NOREVALIDATE|SCDLG_16BIT)));
00463
00464
00465
00466
00467
if (((LPDLGTEMPLATE2)lpdt)->wSignature == 0xffff) {
00468
00469 UserAssert(((LPDLGTEMPLATE2)lpdt)->wDlgVer == 1);
00470 RtlCopyMemory(&dt, lpdt,
sizeof dt);
00471 }
else {
00472
dt.wDlgVer = 0;
00473
dt.wSignature = 0;
00474
dt.dwHelpID = 0;
00475
dt.dwExStyle = lpdt->dwExtendedStyle;
00476
dt.style = lpdt->style;
00477
dt.cDlgItems = lpdt->cdit;
00478
dt.x = lpdt->x;
00479
dt.y = lpdt->y;
00480
dt.cx = lpdt->cx;
00481
dt.cy = lpdt->cy;
00482 }
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493
00494
00495
00496 dsStyleOld = LOWORD(
dt.style);
00497
00498
00499
00500
00501
00502 dwExpWinVer =
GETEXPWINVER(hmod);
00503
00504
if ( f40Compat =
Is400Compat(dwExpWinVer) ) {
00505
dt.style &= (DS_VALID40 | 0xffff0000);
00506
00507
00508
00509
00510
00511
00512
00513
00514
00515
00516
00517
00518
if (
GETAPPVER() <
VER40) {
00519
if (
dt.style & DS_COMMONDIALOG) {
00520
dt.style &= ~DS_3DLOOK;
00521 dsStyleOld &= ~DS_3DLOOK;
00522 }
00523 }
else {
00524
dt.style |= DS_3DLOOK;
00525 dsStyleOld |= DS_3DLOOK;
00526 }
00527 }
else {
00528
#if DBG
00529
if (
dt.style != (
dt.style & (DS_VALID31 | DS_3DLOOK | 0xffff0000))) {
00530 RIPMSG1(RIP_WARNING,
"CreateDialog: stripping invalid bits %lX",
dt.style);
00531 }
00532
#endif // DBG
00533
00534
00535
00536
00537
00538
00539
00540 }
00541
00542
if (LOWORD((ULONG_PTR)hmod) == 0) {
00543
if (
dt.style & DS_SETFOREGROUND)
00544 bFlags |=
CD_SETFOREGROUND;
00545 }
00546
00547
if (dsStyleOld != LOWORD(
dt.style))
00548 {
00549
00550 RIPMSG1(f40Compat ? RIP_ERROR : RIP_WARNING,
00551
"Bad dialog style bits (%x) - please remove.",
00552 LOWORD(
dt.style));
00553
00554
00555
if (f40Compat) {
00556
return NULL;
00557 }
00558 }
00559
00560
if (
dt.style & DS_MODALFRAME) {
00561
dt.dwExStyle |= WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE;
00562 }
00563
00564
if ((
dt.style & DS_CONTEXTHELP) && f40Compat) {
00565
dt.dwExStyle |= WS_EX_CONTEXTHELP;
00566 }
00567
00568
if (
dt.style & DS_CONTROL) {
00569
00570
00571
dt.style &= ~(WS_CAPTION | WS_SYSMENU | DS_SYSMODAL);
00572 }
else if (
dt.style & WS_DLGFRAME) {
00573
00574
dt.dwExStyle |= WS_EX_WINDOWEDGE;
00575 }
00576
00577
if (
dt.style & DS_SYSMODAL) {
00578
dt.dwExStyle |= WS_EX_TOPMOST;
00579 }
00580
00581
if (!(
dt.style & WS_CHILD) || (
dt.style & DS_CONTROL)) {
00582
00583
00584
dt.dwExStyle |= WS_EX_CONTROLPARENT;
00585 }
00586
00587
if (
dt.x == (
short)
CW2_USEDEFAULT) {
00588 bFlags |=
CD_USEDEFAULTX;
00589
dt.x = 0;
00590 }
00591
00592
if (
dt.cx == (
short)
CW2_USEDEFAULT) {
00593 bFlags |=
CD_USEDEFAULTCX;
00594
dt.cx = 0;
00595 }
else if (
dt.cx < 0) {
00596
dt.cx = 0;
00597 }
00598
00599
if (
dt.cy < 0) {
00600
dt.cy = 0;
00601 }
00602
00603
00604
00605 lpszMenu = (LPWSTR)(((
PBYTE)(lpdt)) + (
dt.wDlgVer ?
sizeof(DLGTEMPLATE2):
sizeof(DLGTEMPLATE)));
00606
00607
00608
00609
00610
00611 w = *(LPWORD)lpszMenu;
00612
00613
00614
00615
00616
if (w != 0) {
00617
if ((hMenu = LoadMenu(hmod, (w == 0xFFFF) ?
00618 MAKEINTRESOURCE(*(WORD *)((PBYTE)lpszMenu + 2)) : lpszMenu)) ==
NULL) {
00619 RIPMSG0(RIP_WARNING,
"ServerCreateDialog() failed: couldn't load menu");
00620
goto DeleteFontAndMenuAndFail;
00621 }
00622 }
else {
00623 hMenu =
NULL;
00624 }
00625
00626
if (w == 0xFFFF) {
00627 lpszClass = (LPWSTR)((LPBYTE)lpszMenu + 4);
00628 }
else {
00629 lpszClass = (
UTCHAR *)
WordSkipSz(lpszMenu);
00630 }
00631
00632 lpszText = (
UTCHAR *)
WordSkipSz(lpszClass);
00633
00634 lpStr = (
UTCHAR *)
WordSkipSz(lpszText);
00635
00636 hdcDlg = CreateCompatibleDC(NULL);
00637
if (hdcDlg ==
NULL)
00638
goto DeleteFontAndMenuAndFail;
00639
00640
if (
dt.style & DS_SETFONT) {
00641 hNewFont =
CreateDlgFont(hdcDlg, &lpStr, &dt, dwExpWinVer);
00642 bFlags |=
CD_USERFONT;
00643 lpdit = (LPDLGITEMTEMPLATE)
NextDWordBoundary(lpStr);
00644 }
else if (
Is400Compat(dwExpWinVer) && (
dt.style & DS_FIXEDSYS)) {
00645
00646
00647
00648
00649
00650
00651
00652
00653
00654 hNewFont = GetStockObject(SYSTEM_FIXED_FONT);
00655 bFlags |=
CD_USERFONT;
00656 lpdit = (LPDLGITEMTEMPLATE)
NextDWordBoundary(lpStr);
00657 }
else {
00658 lpdit = (LPDLGITEMTEMPLATE)
NextDWordBoundary(lpStr);
00659 }
00660
00661
00662
00663
00664
00665
00666
00667
00668
00669
00670
00671
00672
if (hNewFont && (hOldFont = SelectFont(hdcDlg, hNewFont))) {
00673
00674 cxChar = GdiGetCharDimensions(hdcDlg, NULL, &cyChar);
00675
00676 SelectFont(hdcDlg, hOldFont);
00677
if (cxChar == 0) {
00678 RIPMSG0(RIP_WARNING,
"InternalCreateDialog: GdiGetCharDimensions failed");
00679
goto UseSysFontMetrics;
00680 }
00681 }
00682
else
00683 {
00684
if (hNewFont || (bFlags &
CD_USERFONT))
00685 hNewFont =
ghFontSys;
00686
00687 UseSysFontMetrics:
00688 cxChar =
gpsi->cxSysFontChar;
00689 cyChar =
gpsi->cySysFontChar;
00690 }
00691 DeleteDC(hdcDlg);
00692
00693
if (
dt.style & WS_VISIBLE) {
00694 bFlags |=
CD_VISIBLE;
00695
dt.style &= ~WS_VISIBLE;
00696 }
00697
00698
if (!(
dt.style & DS_LOCALEDIT)) {
00699 bFlags |=
CD_GLOBALEDIT;
00700 }
00701
00702
00703
00704 rc.left = rc.top = 0;
00705 rc.right =
XPixFromXDU(
dt.cx, cxChar);
00706 rc.bottom =
YPixFromYDU(
dt.cy, cyChar);
00707
00708
_AdjustWindowRectEx(&rc,
dt.style, w,
dt.dwExStyle);
00709
00710
dt.cx = (
SHORT)(rc.right - rc.left);
00711
dt.cy = (
SHORT)(rc.bottom - rc.top);
00712
00713
if ((
dt.style & DS_CENTERMOUSE) &&
SYSMET(MOUSEPRESENT) && f40Compat) {
00714 pMonitor =
_MonitorFromPoint(
gpsi->ptCursor, MONITOR_DEFAULTTONULL);
00715 UserAssert(pMonitor);
00716 *((LPPOINT)&rc.left) =
gpsi->ptCursor;
00717 rc.left -= (
dt.cx / 2);
00718 rc.top -= (
dt.cy / 2);
00719 }
else {
00720
BOOL fNoDialogMonitor;
00721
00722 pMonitor =
GetDialogMonitor(hwndOwner, MONITOR_DEFAULTTONULL);
00723 fNoDialogMonitor = pMonitor ?
FALSE :
TRUE;
00724
if (!pMonitor) {
00725 pMonitor =
GetPrimaryMonitor();
00726 }
00727
00728
if ((
dt.style & (DS_CENTER | DS_CENTERMOUSE)) && f40Compat) {
00729
00730
00731
00732 rc.left = (pMonitor->
rcWork.left + pMonitor->
rcWork.right -
dt.cx) / 2;
00733 rc.top = (pMonitor->
rcWork.top + pMonitor->
rcWork.bottom -
dt.cy) / 2;
00734 }
else {
00735 rc.left =
XPixFromXDU(
dt.x, cxChar);
00736 rc.top =
YPixFromYDU(
dt.y, cyChar);
00737
00738
if (!(
dt.style & DS_ABSALIGN) && hwndOwner) {
00739
00740
00741
00742
00743
if ((HIWORD(
dt.style) &
MaskWF(WFTYPEMASK)) !=
MaskWF(WFCHILD)) {
00744
00745
ClientToScreen(hwndOwner, (LPPOINT)&rc.left);
00746
00747
#ifdef USE_MIRRORING
00748
00749
00750
if (MIRRORED_HWND(hwndOwner)) {
00751 rc.left -=
dt.cx;
00752 }
00753
#endif
00754
00755 }
00756 }
else {
00757
00758
00759
00760
00761
00762
00763
00764
00765
PMONITOR pMonitorTemplate;
00766 RECT rcTemplate;
00767
00768 rcTemplate.left = rc.left;
00769 rcTemplate.top = rc.top;
00770 rcTemplate.right = rc.left +
dt.cx;
00771 rcTemplate.bottom = rc.top +
dt.cy;
00772
00773 pMonitorTemplate =
_MonitorFromRect(&rcTemplate, MONITOR_DEFAULTTOPRIMARY);
00774
if (fNoDialogMonitor) {
00775 pMonitor = pMonitorTemplate;
00776 }
else if (pMonitorTemplate != pMonitor) {
00777 rc.left += pMonitor->
rcMonitor.left - pMonitorTemplate->
rcMonitor.left;
00778 rc.top += pMonitor->
rcMonitor.top - pMonitorTemplate->
rcMonitor.top;
00779 }
00780 }
00781 }
00782 }
00783
00784 rc.right = rc.left +
dt.cx;
00785 rc.bottom = rc.top +
dt.cy;
00786
00787
00788
00789
00790
if (rc.left > rc.right || rc.top > rc.bottom) {
00791
OffsetRect(&rc, -
dt.cx, -
dt.cy);
00792 }
00793
00794
00795
00796
00797
00798
00799
00800
00801
RepositionRect(pMonitor, &rc,
dt.style,
dt.dwExStyle);
00802
00803
dt.x = (
SHORT)((bFlags &
CD_USEDEFAULTX) ?
CW2_USEDEFAULT : rc.left);
00804
dt.y = (
SHORT)(rc.top);
00805
dt.cx = (
SHORT)((bFlags &
CD_USEDEFAULTCX) ?
CW2_USEDEFAULT : rc.right - rc.left);
00806
dt.cy = (
SHORT)(rc.bottom - rc.top);
00807
00808
if (*lpszClass != 0) {
00809
if (
IS_PTR(lpszClass)) {
00810
RtlInitLargeUnicodeString((
PLARGE_UNICODE_STRING)&strClassName,
00811 lpszClass, (UINT)-1);
00812 pstrClassName = &strClassName;
00813 }
else {
00814 pstrClassName = (
PLARGE_STRING)lpszClass;
00815 }
00816 }
else {
00817 pstrClassName = (
PLARGE_STRING)
DIALOGCLASS;
00818 }
00819
00820
RtlInitLargeUnicodeString((
PLARGE_UNICODE_STRING)&strWindowName,
00821 lpszText, (UINT)-1);
00822
00823
00824
00825
00826
00827
00828 bResizeMe=
FALSE;
00829
if(!( (
dt.style & WS_DLGFRAME) && (
dt.style & WS_THICKFRAME) ))
00830 {
00831
if ( (
dt.style & WS_CHILD) ==
FALSE )
00832 {
00833
00834
dt.style |= ( WS_DLGFRAME | WS_THICKFRAME );
00835 bResizeMe=
TRUE;
00836 }
00837 }
00838
00839 UserAssert((
dt.dwExStyle & WS_EX_MDICHILD) == 0);
00840 hwnd =
NtUserCreateWindowEx(
00841
dt.dwExStyle | ((fSCDLGFlags & SCDLG_ANSI) ? WS_EX_ANSICREATOR : 0),
00842 pstrClassName,
00843 &strWindowName,
00844
dt.style,
00845
DefShortToInt(
dt.x),
00846
dt.y,
00847
DefShortToInt(
dt.cx),
00848
dt.cy,
00849 hwndOwner,
00850 hMenu,
00851 hmod,
00852 (LPVOID)NULL,
00853 dwExpWinVer);
00854
00855
if (hwnd ==
NULL) {
00856 RIPMSG0(RIP_WARNING,
"CreateDialog() failed: couldn't create window");
00857 DeleteFontAndMenuAndFail:
00858
if (hMenu !=
NULL)
00859
NtUserDestroyMenu(hMenu);
00860
00861
00862
00863
00864
if ((hNewFont !=
NULL)) {
00865 DeleteObject(hNewFont);
00866 }
00867
return NULL;
00868 }
00869
00870 pwnd =
ValidateHwnd(hwnd);
00871
00872
00873
00874
if(fSCDLGFlags & SCDLG_16BIT) {
00875
TellWOWThehDlg(hwnd);
00876 }
00877
00878
00879
00880
00881
00882
if (pwnd ==
NULL || !
ValidateDialogPwnd(pwnd))
00883
goto DeleteFontAndMenuAndFail;
00884
00885
if (
dt.dwHelpID) {
00886
NtUserSetWindowContextHelpId(hwnd,
dt.dwHelpID);
00887 }
00888
00889
00890
00891
00892
if (
TestWF(pwnd, WFSYSMENU)) {
00893
00894
00895
00896
00897
00898 UserAssert(
HIBYTE(WFSIZEBOX) ==
HIBYTE(WFMINBOX));
00899 UserAssert(
HIBYTE(WFMINBOX) ==
HIBYTE(WFMAXBOX));
00900
if (!
TestWF(pwnd, WFSIZEBOX | WFMINBOX | WFMAXBOX)) {
00901
00902
NtUserCallHwndLock(hwnd, SFI_XXXSETDIALOGSYSTEMMENU);
00903 }
else {
00904
00905
00906
00907
00908
00909
NtUserGetSystemMenu(hwnd, FALSE);
00910 }
00911 }
00912
00913
00914
00915
00916
00917
PDLG(pwnd)->fDisabled =
FALSE;
00918
00919
PDLG(pwnd)->cxChar = cxChar;
00920
PDLG(pwnd)->cyChar = cyChar;
00921
PDLG(pwnd)->lpfnDlg = lpfnDialog;
00922
PDLG(pwnd)->fEnd =
FALSE;
00923
PDLG(pwnd)->result = IDOK;
00924
PDLG(pwnd)->pDlgResize =
NULL;
00925
00926
00927
00928
00929
if(bResizeMe)
00930
PDLG(pwnd)->pDlgResize=
MakeAResizeDlg(0,hmod);
00931
00932
00933
00934
00935
if (fSCDLGFlags & SCDLG_ANSI) {
00936
PDLG(pwnd)->flags |=
DLGF_ANSI;
00937 }
00938
00939
00940
00941
00942
00943
00944
00945
00946
00947
00948
00949
if (LOWORD((ULONG_PTR)hmod) != 0) {
00950 fWowWindow =
TRUE;
00951 }
else {
00952 fWowWindow =
FALSE;
00953 }
00954
00955
00956
00957
00958
00959
if (bFlags &
CD_USERFONT) {
00960
00961
PDLG(pwnd)->hUserFont = hNewFont;
00962
00963
if (lpfnDialog !=
NULL) {
00964
00965
00966
00967
SendMessageWorker(pwnd, WM_SETFONT, (WPARAM)hNewFont, 0L, FALSE);
00968 }
00969 }
00970
00971
if (!
dt.wDlgVer) {
00972 dit.dwHelpID = 0;
00973 }
00974
00975
00976
00977
00978
00979
while (
dt.cDlgItems-- != 0) {
00980
DWORD dwExpWinVer2;
00981
00982
if (
dt.wDlgVer) {
00983 RtlCopyMemory(&dit, lpdit,
sizeof dit);
00984 }
else {
00985 dit.dwHelpID = 0;
00986 dit.dwExStyle = lpdit->dwExtendedStyle;
00987 dit.style = lpdit->style;
00988 dit.x = lpdit->x;
00989 dit.y = lpdit->y;
00990 dit.cx = lpdit->cx;
00991 dit.cy = lpdit->cy;
00992 dit.dwID = lpdit->id;
00993 }
00994
00995 dit.x =
XPixFromXDU(dit.x, cxChar);
00996 dit.y =
YPixFromYDU(dit.y, cyChar);
00997 dit.cx =
XPixFromXDU(dit.cx, cxChar);
00998 dit.cy =
YPixFromYDU(dit.cy, cyChar);
00999
01000 lpszClass = (LPWSTR)(((
PBYTE)(lpdit)) + (
dt.wDlgVer ?
sizeof(DLGITEMTEMPLATE2):
sizeof(DLGITEMTEMPLATE)));
01001
01002
01003
01004
01005
01006
if (*(LPWORD)lpszClass == 0xFFFF) {
01007 lpszText = lpszClass + 2;
01008 lpszClass = (LPWSTR)(
gpsi->
atomSysClass[*(((LPWORD)lpszClass)+1) & ~
CODEBIT]);
01009 }
else {
01010 lpszText = (
UTCHAR *)
SkipSz(lpszClass);
01011 }
01012 lpszText = (
UTCHAR *)
NextWordBoundary(lpszText);
01013
01014 dit.dwExStyle |= WS_EX_NOPARENTNOTIFY;
01015
01016
01017
01018
01019
01020
01021
01022
01023
01024
01025
01026
01027
01028
01029
01030
01031
01032
if (
TestWF(pwnd, DF3DLOOK)) {
01033
if ( (dit.style & WS_BORDER) ||
01034 (lpszClass == MAKEINTRESOURCE(
gpsi->
atomSysClass[ICLS_COMBOBOX]))) {
01035
01036 dit.style &= ~WS_BORDER;
01037 dit.dwExStyle |= WS_EX_CLIENTEDGE;
01038 }
01039 }
01040
01041
01042
01043
01044
01045
01046
if (*(LPWORD)lpszText == 0xFFFF) {
01047 lpCreateParams = (LPWSTR)((
PBYTE)lpszText + 4);
01048 strWindowName.
Buffer = lpszText;
01049 strWindowName.
Length = 4;
01050 strWindowName.
MaximumLength = 4;
01051 strWindowName.
bAnsi =
FALSE;
01052 }
else {
01053 lpCreateParams = (LPWSTR)((
PBYTE)
WordSkipSz(lpszText));
01054
RtlInitLargeUnicodeString((
PLARGE_UNICODE_STRING)&strWindowName,
01055 lpszText, (UINT)-1);
01056 }
01057
01058
01059
01060
01061
01062
01063
if (fWowWindow && (bFlags &
CD_GLOBALEDIT) &&
01064 ((!
IS_PTR(lpszClass) &&
01065
PTR_TO_ID(lpszClass) == (ATOM)(
gpsi->
atomSysClass[
ICLS_EDIT])) ||
01066 (
IS_PTR(lpszClass) &&
01067 (wcscmp(lpszClass, szEDITCLASS) == 0)))) {
01068
01069
01070
01071
01072
if (!(
PDLG(pwnd)->hData)) {
01073
PDLG(pwnd)->hData =
GetEditDS();
01074
if (!(
PDLG(pwnd)->hData))
01075
goto NoCreate;
01076 }
01077
01078 hmodCreate =
PDLG(pwnd)->hData;
01079 dwExpWinVer2 =
GETEXPWINVER(hmodCreate);
01080 }
else {
01081 hmodCreate = hmod;
01082 dwExpWinVer2 = dwExpWinVer;
01083 }
01084
01085 UserAssert((dit.dwExStyle & WS_EX_ANSICREATOR) == 0);
01086
01087
01088
01089
01090
01091
01092
01093
01094
01095
01096
01097
if (*lpCreateParams) {
01098 lpCreateParamsData = (LPBYTE)lpCreateParams;
01099
if (fWowWindow || fSCDLGFlags & SCDLG_16BIT) {
01100 lpCreateParamsData =
01101 (LPBYTE)*(UNALIGNED
DWORD *)
01102 (lpCreateParamsData +
sizeof(WORD));
01103 }
01104 }
else {
01105 lpCreateParamsData =
NULL;
01106 }
01107
01108
01109
01110
01111
01112
01113
01114
if (dit.dwID) {
01115
01116
01117
01118 dit.style |= WS_CHILD;
01119 dit.style &= ~WS_POPUP;
01120 }
01121
01122
if (
IS_PTR(lpszClass)) {
01123
RtlInitLargeUnicodeString((
PLARGE_UNICODE_STRING)&strClassName,
01124 lpszClass, (UINT)-1);
01125 pstrClassName = &strClassName;
01126 }
else {
01127 pstrClassName = (
PLARGE_STRING)lpszClass;
01128 }
01129 UserAssert((dit.dwExStyle & WS_EX_MDICHILD) == 0);
01130
01131 hwnd2 =
NtUserCreateWindowEx(
01132 dit.dwExStyle | ((fSCDLGFlags & SCDLG_ANSI) ? WS_EX_ANSICREATOR : 0),
01133 pstrClassName,
01134 &strWindowName,
01135 dit.style,
01136
DefShortToInt(dit.x),
01137 dit.y,
01138
DefShortToInt(dit.cx),
01139 dit.cy,
01140 hwnd,
01141 (HMENU)dit.dwID,
01142 hmodCreate,
01143 lpCreateParamsData,
01144 dwExpWinVer2);
01145
01146
if (hwnd2 ==
NULL) {
01147 NoCreate:
01148
01149
01150
01151
if (!
TestWF(pwnd, DFNOFAILCREATE)) {
01152 RIPMSG0(RIP_WARNING,
"CreateDialog() failed: couldn't create control");
01153
NtUserDestroyWindow(hwnd);
01154
return NULL;
01155 }
01156 }
else {
01157
01158
if (dit.dwHelpID) {
01159
NtUserSetWindowContextHelpId(hwnd2, dit.dwHelpID);
01160 }
01161
01162
01163
01164
01165
01166
if (hNewFont !=
NULL) {
01167
SendMessage(hwnd2, WM_SETFONT, (WPARAM)hNewFont, 0L);
01168 }
01169
01170
01171
01172
01173
if (
SendMessage(hwnd2, WM_GETDLGCODE, 0, 0L) & DLGC_DEFPUSHBUTTON) {
01174
PDLG(pwnd)->result = dit.dwID;
01175 }
01176 }
01177
01178
01179
01180 lpdit = (LPDLGITEMTEMPLATE)
NextDWordBoundary(
01181 (LPBYTE)(lpCreateParams + 1) + *lpCreateParams);
01182 }
01183
01184
if (!
TestWF(pwnd, DFCONTROL)) {
01185
PWND pwndT =
_GetNextDlgTabItem(pwnd, NULL, FALSE);
01186 hwndEditFirst =
HW(pwndT);
01187 }
01188
01189
if (lpfnDialog !=
NULL) {
01190 fSuccess =
SendMessageWorker(pwnd, WM_INITDIALOG,
01191 (WPARAM)hwndEditFirst, lParam, FALSE);
01192
01193
01194
01195
01196
if (!
RevalidateHwnd(hwnd)) {
01197
goto CreateDialogReturn;
01198 }
01199
01200
if (fSuccess && !
PDLG(pwnd)->fEnd) {
01201
01202
01203
01204
01205
01206
01207
01208
01209
01210
if (!
TestWF(pwnd, DFCONTROL)) {
01211
PWND pwndT;
01212
if (!
IsWindow(hwndEditFirst) ||
TestWF(pwnd, WFWIN40COMPAT))
01213 hwndEditFirst =
NULL;
01214
01215
01216
01217
01218
01219 pwndT =
_GetNextDlgTabItem(pwnd, NULL, FALSE);
01220
if (hwndNewFocus =
HW(pwndT)) {
01221
DlgSetFocus(hwndNewFocus);
01222 }
01223
01224
xxxCheckDefPushButton(pwnd, hwndEditFirst, hwndNewFocus);
01225 }
01226 }
01227 }
01228
01229
if (!
IsWindow(hwnd))
01230 {
01231
01232
01233
01234
if (
GETAPPVER() <
VER40) {
01235
return(hwnd);
01236 }
01237
01238
return(
NULL);
01239 }
01240
01241
01242
01243
01244
01245
if (bFlags &
CD_SETFOREGROUND) {
01246
NtUserSetForegroundWindow(hwnd);
01247
if (!
IsWindow(hwnd)) {
01248 hwnd =
NULL;
01249
goto CreateDialogReturn;
01250 }
01251 }
01252
01253
if ((bFlags &
CD_VISIBLE) && !
PDLG(pwnd)->fEnd && (!
TestWF(pwnd, WFVISIBLE))) {
01254
NtUserShowWindow(hwnd, SHOW_OPENWINDOW);
01255
UpdateWindow(hwnd);
01256 }
01257
01258 CreateDialogReturn:
01259
01260
01261
01262
01263
01264
01265
if (!(fSCDLGFlags & SCDLG_NOREVALIDATE) && !
RevalidateHwnd(hwnd)) {
01266 hwnd =
NULL;
01267 }
01268
01269
return hwnd;
01270 }