DWL_USER might be used otherwise, so use an internal window property
[wine/wine-kai.git] / dlls / commdlg / printdlg16.c
blob3d1bcd2aa7c349d57381d146bfac122cc744758f
1 /*
2 * COMMDLG - Print Dialog
4 * Copyright 1994 Martin Ayotte
5 * Copyright 1996 Albrecht Kleine
6 * Copyright 1999 Klaas van Gend
7 * Copyright 2000 Huw D M Davies
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #include <ctype.h>
25 #include <stdlib.h>
26 #include <stdarg.h>
27 #include <stdio.h>
28 #include <string.h>
30 #define NONAMELESSUNION
31 #define NONAMELESSSTRUCT
32 #include "windef.h"
33 #include "winbase.h"
34 #include "wingdi.h"
35 #include "wine/wingdi16.h"
36 #include "winuser.h"
37 #include "wine/winuser16.h"
38 #include "commdlg.h"
39 #include "dlgs.h"
40 #include "wine/debug.h"
41 #include "cderr.h"
42 #include "winspool.h"
43 #include "winerror.h"
45 WINE_DEFAULT_DEBUG_CHANNEL(commdlg);
47 #include "cdlg.h"
48 #include "cdlg16.h"
49 #include "printdlg.h"
51 static BOOL PRINTDLG_CreateDevNames16(HGLOBAL16 *hmem, char* DeviceDriverName,
52 char* DeviceName, char* OutputPort)
54 long size;
55 char* pDevNamesSpace;
56 char* pTempPtr;
57 LPDEVNAMES lpDevNames;
58 char buf[260];
60 size = strlen(DeviceDriverName) + 1
61 + strlen(DeviceName) + 1
62 + strlen(OutputPort) + 1
63 + sizeof(DEVNAMES);
65 if(*hmem)
66 *hmem = GlobalReAlloc16(*hmem, size, GMEM_MOVEABLE);
67 else
68 *hmem = GlobalAlloc16(GMEM_MOVEABLE, size);
69 if (*hmem == 0)
70 return FALSE;
72 pDevNamesSpace = GlobalLock16(*hmem);
73 lpDevNames = (LPDEVNAMES) pDevNamesSpace;
75 pTempPtr = pDevNamesSpace + sizeof(DEVNAMES);
76 strcpy(pTempPtr, DeviceDriverName);
77 lpDevNames->wDriverOffset = pTempPtr - pDevNamesSpace;
79 pTempPtr += strlen(DeviceDriverName) + 1;
80 strcpy(pTempPtr, DeviceName);
81 lpDevNames->wDeviceOffset = pTempPtr - pDevNamesSpace;
83 pTempPtr += strlen(DeviceName) + 1;
84 strcpy(pTempPtr, OutputPort);
85 lpDevNames->wOutputOffset = pTempPtr - pDevNamesSpace;
87 PRINTDLG_GetDefaultPrinterNameA(buf, sizeof(buf));
88 lpDevNames->wDefault = (strcmp(buf, DeviceName) == 0) ? 1 : 0;
89 GlobalUnlock16(*hmem);
90 return TRUE;
94 /***********************************************************************
95 * PRINTDLG_WMInitDialog [internal]
97 static LRESULT PRINTDLG_WMInitDialog16(HWND hDlg, WPARAM wParam,
98 PRINT_PTRA* PrintStructures)
100 LPPRINTDLG16 lppd = PrintStructures->dlg.lpPrintDlg16;
101 DEVNAMES *pdn;
102 DEVMODEA *pdm;
103 char *name = NULL;
104 UINT comboID = (lppd->Flags & PD_PRINTSETUP) ? cmb1 : cmb4;
106 /* load Collate ICONs */
107 PrintStructures->hCollateIcon =
108 LoadIconA(COMDLG32_hInstance, "PD32_COLLATE");
109 PrintStructures->hNoCollateIcon =
110 LoadIconA(COMDLG32_hInstance, "PD32_NOCOLLATE");
111 if(PrintStructures->hCollateIcon == 0 ||
112 PrintStructures->hNoCollateIcon == 0) {
113 ERR("no icon in resourcefile\n");
114 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
115 EndDialog(hDlg, FALSE);
118 /* load Paper Orientation ICON */
119 /* FIXME: not implemented yet */
122 * if lppd->Flags PD_SHOWHELP is specified, a HELPMESGSTRING message
123 * must be registered and the Help button must be shown.
125 if (lppd->Flags & PD_SHOWHELP) {
126 if((PrintStructures->HelpMessageID =
127 RegisterWindowMessageA(HELPMSGSTRINGA)) == 0) {
128 COMDLG32_SetCommDlgExtendedError(CDERR_REGISTERMSGFAIL);
129 return FALSE;
131 } else
132 PrintStructures->HelpMessageID = 0;
134 if (!(lppd->Flags & PD_PRINTSETUP)) {
135 /* We have a print quality combo box. What shall we do? */
136 if (GetDlgItem(hDlg,cmb1)) {
137 char buf [20];
139 FIXME("Print quality only displaying currently.\n");
141 pdm = GlobalLock16(lppd->hDevMode);
142 if(pdm) {
143 switch (pdm->dmPrintQuality) {
144 case DMRES_HIGH : strcpy(buf,"High");break;
145 case DMRES_MEDIUM : strcpy(buf,"Medium");break;
146 case DMRES_LOW : strcpy(buf,"Low");break;
147 case DMRES_DRAFT : strcpy(buf,"Draft");break;
148 case 0 : strcpy(buf,"Default");break;
149 default : sprintf(buf,"%ddpi",pdm->dmPrintQuality);break;
151 GlobalUnlock16(lppd->hDevMode);
152 } else
153 strcpy(buf,"Default");
154 SendDlgItemMessageA(hDlg,cmb1,CB_ADDSTRING,0,(LPARAM)buf);
155 SendDlgItemMessageA(hDlg,cmb1,CB_SETCURSEL,0,0);
156 EnableWindow(GetDlgItem(hDlg,cmb1),FALSE);
160 /* FIXME: I allow more freedom than either Win95 or WinNT,
161 * which do not agree to what errors should be thrown or not
162 * in case nToPage or nFromPage is out-of-range.
164 if (lppd->nMaxPage < lppd->nMinPage)
165 lppd->nMaxPage = lppd->nMinPage;
166 if (lppd->nMinPage == lppd->nMaxPage)
167 lppd->Flags |= PD_NOPAGENUMS;
168 if (lppd->nToPage < lppd->nMinPage)
169 lppd->nToPage = lppd->nMinPage;
170 if (lppd->nToPage > lppd->nMaxPage)
171 lppd->nToPage = lppd->nMaxPage;
172 if (lppd->nFromPage < lppd->nMinPage)
173 lppd->nFromPage = lppd->nMinPage;
174 if (lppd->nFromPage > lppd->nMaxPage)
175 lppd->nFromPage = lppd->nMaxPage;
177 /* If the printer combo box is in the dialog, fill it */
178 if (GetDlgItem(hDlg,comboID)) {
179 /* Fill Combobox
181 pdn = GlobalLock16(lppd->hDevNames);
182 pdm = GlobalLock16(lppd->hDevMode);
183 if(pdn)
184 name = (char*)pdn + pdn->wDeviceOffset;
185 else if(pdm)
186 name = pdm->dmDeviceName;
187 PRINTDLG_SetUpPrinterListComboA(hDlg, comboID, name);
188 if(pdm) GlobalUnlock16(lppd->hDevMode);
189 if(pdn) GlobalUnlock16(lppd->hDevNames);
191 /* Now find selected printer and update rest of dlg */
192 name = HeapAlloc(GetProcessHeap(),0,256);
193 if (GetDlgItemTextA(hDlg, comboID, name, 255))
194 PRINTDLG_ChangePrinterA(hDlg, name, PrintStructures);
195 } else {
196 /* else just use default printer */
197 char name[200];
198 BOOL ret = PRINTDLG_GetDefaultPrinterNameA(name, sizeof(name));
200 if (ret)
201 PRINTDLG_ChangePrinterA(hDlg, name, PrintStructures);
202 else
203 FIXME("No default printer found, expect problems!\n");
205 HeapFree(GetProcessHeap(),0,name);
207 return TRUE;
210 /************************************************************
212 * PRINTDLG_Get16TemplateFrom32 [Internal]
213 * Generates a 16 bits template from the Wine 32 bits resource
216 static HGLOBAL16 PRINTDLG_Get16TemplateFrom32(LPCSTR PrintResourceName)
218 HRSRC hResInfo;
219 HGLOBAL hDlgTmpl32;
220 LPCVOID template32;
221 DWORD size;
222 HGLOBAL16 hGlobal16;
223 LPVOID template;
225 if (!(hResInfo = FindResourceA(COMDLG32_hInstance,
226 PrintResourceName, (LPSTR)RT_DIALOG)))
228 COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);
229 return 0;
231 if (!(hDlgTmpl32 = LoadResource(COMDLG32_hInstance, hResInfo )) ||
232 !(template32 = LockResource( hDlgTmpl32 )))
234 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
235 return 0;
237 size = SizeofResource(COMDLG32_hInstance, hResInfo);
238 hGlobal16 = GlobalAlloc16(0, size);
239 if (!hGlobal16)
241 COMDLG32_SetCommDlgExtendedError(CDERR_MEMALLOCFAILURE);
242 ERR("alloc failure for %ld bytes\n", size);
243 return 0;
245 template = GlobalLock16(hGlobal16);
246 if (!template)
248 COMDLG32_SetCommDlgExtendedError(CDERR_MEMLOCKFAILURE);
249 ERR("global lock failure for %x handle\n", hGlobal16);
250 GlobalFree16(hGlobal16);
251 return 0;
253 ConvertDialog32To16((LPVOID)template32, size, (LPVOID)template);
254 GlobalUnlock16(hGlobal16);
255 return hGlobal16;
258 static BOOL PRINTDLG_CreateDC16(LPPRINTDLG16 lppd)
260 DEVNAMES *pdn = GlobalLock16(lppd->hDevNames);
261 DEVMODEA *pdm = GlobalLock16(lppd->hDevMode);
263 if(lppd->Flags & PD_RETURNDC) {
264 lppd->hDC = HDC_16(CreateDCA((char*)pdn + pdn->wDriverOffset,
265 (char*)pdn + pdn->wDeviceOffset,
266 (char*)pdn + pdn->wOutputOffset,
267 pdm ));
268 } else if(lppd->Flags & PD_RETURNIC) {
269 lppd->hDC = HDC_16(CreateICA((char*)pdn + pdn->wDriverOffset,
270 (char*)pdn + pdn->wDeviceOffset,
271 (char*)pdn + pdn->wOutputOffset,
272 pdm ));
274 GlobalUnlock16(lppd->hDevNames);
275 GlobalUnlock16(lppd->hDevMode);
276 return lppd->hDC ? TRUE : FALSE;
279 /************************************************************
281 * PRINTDLG_GetDlgTemplate
284 static HGLOBAL16 PRINTDLG_GetDlgTemplate16(PRINTDLG16 *lppd)
286 HGLOBAL16 hDlgTmpl, hResInfo;
288 if (lppd->Flags & PD_PRINTSETUP) {
289 if(lppd->Flags & PD_ENABLESETUPTEMPLATEHANDLE) {
290 hDlgTmpl = lppd->hSetupTemplate;
291 } else if(lppd->Flags & PD_ENABLESETUPTEMPLATE) {
292 hResInfo = FindResource16(lppd->hInstance,
293 MapSL(lppd->lpSetupTemplateName), (LPSTR)RT_DIALOG);
294 hDlgTmpl = LoadResource16(lppd->hInstance, hResInfo);
295 } else {
296 hDlgTmpl = PRINTDLG_Get16TemplateFrom32("PRINT32_SETUP");
298 } else {
299 if(lppd->Flags & PD_ENABLEPRINTTEMPLATEHANDLE) {
300 hDlgTmpl = lppd->hPrintTemplate;
301 } else if(lppd->Flags & PD_ENABLEPRINTTEMPLATE) {
302 hResInfo = FindResource16(lppd->hInstance,
303 MapSL(lppd->lpPrintTemplateName),
304 (LPSTR)RT_DIALOG);
305 hDlgTmpl = LoadResource16(lppd->hInstance, hResInfo);
306 } else {
307 hDlgTmpl = PRINTDLG_Get16TemplateFrom32("PRINT32");
310 return hDlgTmpl;
313 /***********************************************************************
314 * PrintDlg (COMMDLG.20)
316 * Displays the the PRINT dialog box, which enables the user to specify
317 * specific properties of the print job.
319 * RETURNS
320 * nonzero if the user pressed the OK button
321 * zero if the user cancelled the window or an error occurred
323 * BUGS
324 * * calls up to the 32-bit versions of the Dialogs, which look different
325 * * Customizing is *not* implemented.
328 BOOL16 WINAPI PrintDlg16(
329 LPPRINTDLG16 lppd /* [in/out] ptr to PRINTDLG struct */
331 BOOL bRet = FALSE;
332 LPVOID ptr;
333 HINSTANCE16 hInst = GetWindowWord( HWND_32(lppd->hwndOwner), GWL_HINSTANCE );
335 if(TRACE_ON(commdlg)) {
336 char flagstr[1000] = "";
337 struct pd_flags *pflag = pd_flags;
338 for( ; pflag->name; pflag++) {
339 if(lppd->Flags & pflag->flag)
340 strcat(flagstr, pflag->name);
342 TRACE("(%p): hwndOwner = %08x, hDevMode = %08x, hDevNames = %08x\n"
343 "pp. %d-%d, min p %d, max p %d, copies %d, hinst %08x\n"
344 "flags %08lx (%s)\n",
345 lppd, lppd->hwndOwner, lppd->hDevMode, lppd->hDevNames,
346 lppd->nFromPage, lppd->nToPage, lppd->nMinPage, lppd->nMaxPage,
347 lppd->nCopies, lppd->hInstance, lppd->Flags, flagstr);
350 if(lppd->lStructSize != sizeof(PRINTDLG16)) {
351 ERR("structure size (%ld/%d)\n",lppd->lStructSize,sizeof(PRINTDLG16));
352 COMDLG32_SetCommDlgExtendedError(CDERR_STRUCTSIZE);
353 return FALSE;
356 if(lppd->Flags & PD_RETURNDEFAULT) {
357 PRINTER_INFO_2A *pbuf;
358 DRIVER_INFO_3A *dbuf;
359 HANDLE hprn;
360 DWORD needed;
362 if(lppd->hDevMode || lppd->hDevNames) {
363 WARN("hDevMode or hDevNames non-zero for PD_RETURNDEFAULT\n");
364 COMDLG32_SetCommDlgExtendedError(PDERR_RETDEFFAILURE);
365 return FALSE;
367 if(!PRINTDLG_OpenDefaultPrinter(&hprn)) {
368 WARN("Can't find default printer\n");
369 COMDLG32_SetCommDlgExtendedError(PDERR_NODEFAULTPRN);
370 return FALSE;
373 GetPrinterA(hprn, 2, NULL, 0, &needed);
374 pbuf = HeapAlloc(GetProcessHeap(), 0, needed);
375 GetPrinterA(hprn, 2, (LPBYTE)pbuf, needed, &needed);
376 GetPrinterDriverA(hprn, NULL, 3, NULL, 0, &needed);
377 dbuf = HeapAlloc(GetProcessHeap(),0,needed);
378 if (!GetPrinterDriverA(hprn, NULL, 3, (LPBYTE)dbuf, needed, &needed)) {
379 ERR("GetPrinterDriverA failed for %s, le %ld, fix your config!\n",
380 pbuf->pPrinterName,GetLastError());
381 HeapFree(GetProcessHeap(), 0, dbuf);
382 COMDLG32_SetCommDlgExtendedError(PDERR_RETDEFFAILURE);
383 return FALSE;
385 ClosePrinter(hprn);
386 PRINTDLG_CreateDevNames16(&(lppd->hDevNames),
387 dbuf->pDriverPath,
388 pbuf->pPrinterName,
389 pbuf->pPortName);
390 lppd->hDevMode = GlobalAlloc16(GMEM_MOVEABLE,pbuf->pDevMode->dmSize+
391 pbuf->pDevMode->dmDriverExtra);
392 ptr = GlobalLock16(lppd->hDevMode);
393 memcpy(ptr, pbuf->pDevMode, pbuf->pDevMode->dmSize +
394 pbuf->pDevMode->dmDriverExtra);
395 GlobalUnlock16(lppd->hDevMode);
396 HeapFree(GetProcessHeap(), 0, pbuf);
397 HeapFree(GetProcessHeap(), 0, dbuf);
398 bRet = TRUE;
399 } else {
400 HGLOBAL16 hDlgTmpl;
401 PRINT_PTRA *PrintStructures;
403 /* load Dialog resources,
404 * depending on Flags indicates Print32 or Print32_setup dialog
406 hDlgTmpl = PRINTDLG_GetDlgTemplate16(lppd);
407 if (!hDlgTmpl) {
408 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
409 return FALSE;
411 PrintStructures = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
412 sizeof(PRINT_PTRA));
413 PrintStructures->dlg.lpPrintDlg16 = lppd;
414 PrintStructures->dlg.lpPrintDlg = (LPPRINTDLGA)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(PRINTDLGA));
415 #define CVAL(x) PrintStructures->dlg.lpPrintDlg->x = lppd->x;
416 #define MVAL(x) PrintStructures->dlg.lpPrintDlg->x = MapSL(lppd->x);
417 CVAL(Flags);
418 PrintStructures->dlg.lpPrintDlg->hwndOwner = HWND_32(lppd->hwndOwner);
419 PrintStructures->dlg.lpPrintDlg->hDC = HDC_32(lppd->hDC);
420 CVAL(nFromPage);CVAL(nToPage);CVAL(nMinPage);CVAL(nMaxPage);
421 CVAL(nCopies);
422 PrintStructures->dlg.lpPrintDlg->hInstance = HINSTANCE_32(lppd->hInstance);
423 CVAL(lCustData);
424 MVAL(lpPrintTemplateName);MVAL(lpSetupTemplateName);
425 /* Don't copy rest, it is 16 bit specific */
426 #undef MVAL
427 #undef CVAL
429 PrintStructures->lpDevMode = HeapAlloc(GetProcessHeap(),0,sizeof(DEVMODEA));
431 /* and create & process the dialog .
432 * -1 is failure, 0 is broken hwnd, everything else is ok.
434 bRet = (0<DialogBoxIndirectParam16(
435 hInst, hDlgTmpl, lppd->hwndOwner,
436 (DLGPROC16)GetProcAddress16(GetModuleHandle16("COMMDLG"),(LPCSTR)21),
437 (LPARAM)PrintStructures
440 if (!PrintStructures->lpPrinterInfo) bRet = FALSE;
441 if(bRet) {
442 DEVMODEA *lpdm = PrintStructures->lpDevMode, *lpdmReturn;
443 PRINTER_INFO_2A *pi = PrintStructures->lpPrinterInfo;
444 DRIVER_INFO_3A *di = PrintStructures->lpDriverInfo;
446 if (lppd->hDevMode == 0) {
447 TRACE(" No hDevMode yet... Need to create my own\n");
448 lppd->hDevMode = GlobalAlloc16(GMEM_MOVEABLE,
449 lpdm->dmSize + lpdm->dmDriverExtra);
450 } else {
451 WORD locks;
452 if((locks = (GlobalFlags16(lppd->hDevMode)&GMEM_LOCKCOUNT))) {
453 WARN("hDevMode has %d locks on it. Unlocking it now\n", locks);
454 while(locks--) {
455 GlobalUnlock16(lppd->hDevMode);
456 TRACE("Now got %d locks\n", locks);
459 lppd->hDevMode = GlobalReAlloc16(lppd->hDevMode,
460 lpdm->dmSize + lpdm->dmDriverExtra,
461 GMEM_MOVEABLE);
463 lpdmReturn = GlobalLock16(lppd->hDevMode);
464 memcpy(lpdmReturn, lpdm, lpdm->dmSize + lpdm->dmDriverExtra);
466 if (lppd->hDevNames != 0) {
467 WORD locks;
468 if((locks = (GlobalFlags16(lppd->hDevNames)&GMEM_LOCKCOUNT))) {
469 WARN("hDevNames has %d locks on it. Unlocking it now\n", locks);
470 while(locks--)
471 GlobalUnlock16(lppd->hDevNames);
474 PRINTDLG_CreateDevNames16(&(lppd->hDevNames),
475 di->pDriverPath,
476 pi->pPrinterName,
477 pi->pPortName
479 GlobalUnlock16(lppd->hDevMode);
481 if (!(lppd->Flags & (PD_ENABLESETUPTEMPLATEHANDLE | PD_ENABLESETUPTEMPLATE)))
482 GlobalFree16(hDlgTmpl); /* created from the 32 bits resource */
483 HeapFree(GetProcessHeap(), 0, PrintStructures->lpDevMode);
484 HeapFree(GetProcessHeap(), 0, PrintStructures->lpPrinterInfo);
485 HeapFree(GetProcessHeap(), 0, PrintStructures->lpDriverInfo);
486 HeapFree(GetProcessHeap(), 0, PrintStructures);
488 if(bRet && (lppd->Flags & PD_RETURNDC || lppd->Flags & PD_RETURNIC))
489 bRet = PRINTDLG_CreateDC16(lppd);
491 TRACE("exit! (%d)\n", bRet);
492 return bRet;
495 /**********************************************************************
497 * 16 bit commdlg
500 /***********************************************************************
501 * PrintDlgProc (COMMDLG.21)
503 BOOL16 CALLBACK PrintDlgProc16(HWND16 hDlg16, UINT16 uMsg, WPARAM16 wParam,
504 LPARAM lParam)
506 HWND hDlg = HWND_32(hDlg16);
507 PRINT_PTRA* PrintStructures;
508 BOOL16 res = FALSE;
510 if (uMsg!=WM_INITDIALOG) {
511 PrintStructures = (PRINT_PTRA*)GetPropA(hDlg,"__WINE_PRINTDLGDATA");
512 if (!PrintStructures)
513 return FALSE;
514 } else {
515 PrintStructures = (PRINT_PTRA*) lParam;
516 SetPropA(hDlg,"__WINE_PRINTDLGDATA",PrintStructures);
517 res = PRINTDLG_WMInitDialog16(hDlg, wParam, PrintStructures);
519 if(PrintStructures->dlg.lpPrintDlg16->Flags & PD_ENABLEPRINTHOOK) {
520 res = CallWindowProc16(
521 (WNDPROC16)PrintStructures->dlg.lpPrintDlg16->lpfnPrintHook,
522 hDlg16, uMsg, wParam, (LPARAM)PrintStructures->dlg.lpPrintDlg16
525 return res;
528 if(PrintStructures->dlg.lpPrintDlg16->Flags & PD_ENABLEPRINTHOOK) {
529 res = CallWindowProc16(
530 (WNDPROC16)PrintStructures->dlg.lpPrintDlg16->lpfnPrintHook,
531 hDlg16,uMsg, wParam, lParam
533 if(LOWORD(res)) return res;
536 switch (uMsg) {
537 case WM_COMMAND: {
538 /* We need to map those for the 32bit window procedure, compare
539 * with 32Ato16 mapper in winproc.c
541 return PRINTDLG_WMCommandA(
542 hDlg,
543 MAKEWPARAM(wParam,HIWORD(lParam)),
544 LOWORD(lParam),
545 PrintStructures
548 case WM_DESTROY:
549 DestroyIcon(PrintStructures->hCollateIcon);
550 DestroyIcon(PrintStructures->hNoCollateIcon);
551 /* FIXME: don't forget to delete the paper orientation icons here! */
553 return FALSE;
555 return res;
558 /***********************************************************************
559 * PrintSetupDlgProc (COMMDLG.22)
561 BOOL16 CALLBACK PrintSetupDlgProc16(HWND16 hWnd16, UINT16 wMsg, WPARAM16 wParam,
562 LPARAM lParam)
564 HWND hWnd = HWND_32(hWnd16);
565 switch (wMsg)
567 case WM_INITDIALOG:
568 TRACE("WM_INITDIALOG lParam=%08lX\n", lParam);
569 ShowWindow(hWnd, SW_SHOWNORMAL);
570 return (TRUE);
571 case WM_COMMAND:
572 switch (wParam) {
573 case IDOK:
574 EndDialog(hWnd, TRUE);
575 return(TRUE);
576 case IDCANCEL:
577 EndDialog(hWnd, FALSE);
578 return(TRUE);
580 return(FALSE);
582 return FALSE;