Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
b40a9b7f
Commit
b40a9b7f
authored
May 26, 2000
by
Huw D M Davies
Committed by
Alexandre Julliard
May 26, 2000
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add PrintSetup dialog and support for hooks and templates.
Move 16 bit api definitions out of commdlg.h to cdlg.h
parent
fa2c7939
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
1008 additions
and
1084 deletions
+1008
-1084
cdlg.h
dlls/commdlg/cdlg.h
+128
-1
cdlg_En.rc
dlls/commdlg/cdlg_En.rc
+2
-2
comdlg32.spec
dlls/commdlg/comdlg32.spec
+2
-1
filedlg.c
dlls/commdlg/filedlg.c
+6
-0
finddlg.c
dlls/commdlg/finddlg.c
+5
-0
fontdlg.c
dlls/commdlg/fontdlg.c
+4
-0
printdlg.c
dlls/commdlg/printdlg.c
+855
-945
commdlg.h
include/commdlg.h
+6
-135
No files found.
dlls/commdlg/cdlg.h
View file @
b40a9b7f
...
...
@@ -116,5 +116,132 @@ extern LPCSTR (WINAPI *COMDLG32_PathFindFilenameA)(LPCSTR path);
extern
DWORD
(
WINAPI
*
COMDLG32_PathRemoveFileSpecA
)(
LPSTR
fn
);
extern
BOOL
(
WINAPI
*
COMDLG32_PathMatchSpecW
)(
LPCWSTR
x
,
LPCWSTR
y
);
extern
LPSTR
(
WINAPI
*
COMDLG32_PathAddBackslashA
)(
LPSTR
path
);
#endif
extern
BOOL
WINAPI
GetFileDialog95A
(
LPOPENFILENAMEA
ofn
,
UINT
iDlgType
);
extern
BOOL
WINAPI
GetFileDialog95W
(
LPOPENFILENAMEW
ofn
,
UINT
iDlgType
);
/* 16 bit api */
#include "pshpack1.h"
typedef
UINT16
(
CALLBACK
*
LPOFNHOOKPROC16
)(
HWND16
,
UINT16
,
WPARAM16
,
LPARAM
);
typedef
struct
{
DWORD
lStructSize
;
HWND16
hwndOwner
;
HINSTANCE16
hInstance
;
SEGPTR
lpstrFilter
;
SEGPTR
lpstrCustomFilter
;
DWORD
nMaxCustFilter
;
DWORD
nFilterIndex
;
SEGPTR
lpstrFile
;
DWORD
nMaxFile
;
SEGPTR
lpstrFileTitle
;
DWORD
nMaxFileTitle
;
SEGPTR
lpstrInitialDir
;
SEGPTR
lpstrTitle
;
DWORD
Flags
;
UINT16
nFileOffset
;
UINT16
nFileExtension
;
SEGPTR
lpstrDefExt
;
LPARAM
lCustData
;
LPOFNHOOKPROC16
lpfnHook
;
SEGPTR
lpTemplateName
;
}
OPENFILENAME16
,
*
LPOPENFILENAME16
;
typedef
UINT16
(
CALLBACK
*
LPCCHOOKPROC16
)
(
HWND16
,
UINT16
,
WPARAM16
,
LPARAM
);
typedef
struct
{
DWORD
lStructSize
;
HWND16
hwndOwner
;
HWND16
hInstance
;
COLORREF
rgbResult
;
COLORREF
*
lpCustColors
;
DWORD
Flags
;
LPARAM
lCustData
;
LPCCHOOKPROC16
lpfnHook
;
SEGPTR
lpTemplateName
;
}
CHOOSECOLOR16
;
typedef
CHOOSECOLOR16
*
LPCHOOSECOLOR16
;
typedef
UINT16
(
CALLBACK
*
LPFRHOOKPROC16
)(
HWND16
,
UINT16
,
WPARAM16
,
LPARAM
);
typedef
struct
{
DWORD
lStructSize
;
/* size of this struct 0x20 */
HWND16
hwndOwner
;
/* handle to owner's window */
HINSTANCE16
hInstance
;
/* instance handle of.EXE that */
/* contains cust. dlg. template */
DWORD
Flags
;
/* one or more of the FR_?? */
SEGPTR
lpstrFindWhat
;
/* ptr. to search string */
SEGPTR
lpstrReplaceWith
;
/* ptr. to replace string */
UINT16
wFindWhatLen
;
/* size of find buffer */
UINT16
wReplaceWithLen
;
/* size of replace buffer */
LPARAM
lCustData
;
/* data passed to hook fn. */
LPFRHOOKPROC16
lpfnHook
;
SEGPTR
lpTemplateName
;
/* custom template name */
}
FINDREPLACE16
,
*
LPFINDREPLACE16
;
typedef
UINT16
(
CALLBACK
*
LPCFHOOKPROC16
)(
HWND16
,
UINT16
,
WPARAM16
,
LPARAM
);
typedef
struct
{
DWORD
lStructSize
;
HWND16
hwndOwner
;
/* caller's window handle */
HDC16
hDC
;
/* printer DC/IC or NULL */
SEGPTR
lpLogFont
;
/* ptr. to a LOGFONT struct */
short
iPointSize
;
/* 10 * size in points of selected font */
DWORD
Flags
;
/* enum. type flags */
COLORREF
rgbColors
;
/* returned text color */
LPARAM
lCustData
;
/* data passed to hook fn. */
LPCFHOOKPROC16
lpfnHook
;
SEGPTR
lpTemplateName
;
/* custom template name */
HINSTANCE16
hInstance
;
/* instance handle of.EXE that */
/* contains cust. dlg. template */
SEGPTR
lpszStyle
;
/* return the style field here */
/* must be LF_FACESIZE or bigger */
UINT16
nFontType
;
/* same value reported to the */
/* EnumFonts callback with the */
/* extra FONTTYPE_ bits added */
short
nSizeMin
;
/* minimum pt size allowed & */
short
nSizeMax
;
/* max pt size allowed if */
/* CF_LIMITSIZE is used */
}
CHOOSEFONT16
,
*
LPCHOOSEFONT16
;
typedef
UINT16
(
CALLBACK
*
LPPRINTHOOKPROC16
)
(
HWND16
,
UINT16
,
WPARAM16
,
LPARAM
);
typedef
UINT16
(
CALLBACK
*
LPSETUPHOOKPROC16
)
(
HWND16
,
UINT16
,
WPARAM16
,
LPARAM
);
typedef
struct
{
DWORD
lStructSize
;
HWND16
hwndOwner
;
HGLOBAL16
hDevMode
;
HGLOBAL16
hDevNames
;
HDC16
hDC
;
DWORD
Flags
;
WORD
nFromPage
;
WORD
nToPage
;
WORD
nMinPage
;
WORD
nMaxPage
;
WORD
nCopies
;
HINSTANCE16
hInstance
;
LPARAM
lCustData
;
LPPRINTHOOKPROC16
lpfnPrintHook
;
LPSETUPHOOKPROC16
lpfnSetupHook
;
SEGPTR
lpPrintTemplateName
;
SEGPTR
lpSetupTemplateName
;
HGLOBAL16
hPrintTemplate
;
HGLOBAL16
hSetupTemplate
;
}
PRINTDLG16
,
*
LPPRINTDLG16
;
BOOL16
WINAPI
ChooseColor16
(
LPCHOOSECOLOR16
lpChCol
);
HWND16
WINAPI
FindText16
(
SEGPTR
find
);
INT16
WINAPI
GetFileTitle16
(
LPCSTR
lpFile
,
LPSTR
lpTitle
,
UINT16
cbBuf
);
BOOL16
WINAPI
GetOpenFileName16
(
SEGPTR
ofn
);
BOOL16
WINAPI
GetSaveFileName16
(
SEGPTR
ofn
);
BOOL16
WINAPI
PrintDlg16
(
LPPRINTDLG16
print
);
HWND16
WINAPI
ReplaceText16
(
SEGPTR
find
);
BOOL16
WINAPI
ChooseFont16
(
LPCHOOSEFONT16
);
#include "poppack.h"
#endif
/* _WINE_DLL_CDLG_H */
dlls/commdlg/cdlg_En.rc
View file @
b40a9b7f
...
...
@@ -198,7 +198,7 @@ FONT 8, "Helv"
PRINT32 DIALOG LOADONCALL MOVEABLE DISCARDABLE 32, 32, 288, 186
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU |
DS_CONTEXTHELP | DS_3DLOOK
CAPTION "Print
32
"
CAPTION "Print"
FONT 8, "Helv"
{
DEFPUSHBUTTON "OK", IDOK, 180,164, 48,14, WS_GROUP | BS_DEFPUSHBUTTON
...
...
@@ -238,7 +238,7 @@ FONT 8, "Helv"
PRINT32_SETUP DIALOG LOADONCALL MOVEABLE DISCARDABLE 32, 32, 288, 178
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU |
DS_CONTEXTHELP | DS_3DLOOK
CAPTION "Print
32
Setup"
CAPTION "Print Setup"
FONT 8, "Helv"
BEGIN
DEFPUSHBUTTON "OK",IDOK,180,156,48,14,WS_GROUP
...
...
dlls/commdlg/comdlg32.spec
View file @
b40a9b7f
...
...
@@ -2,6 +2,7 @@ name comdlg32
type win32
init COMDLG32_DllEntryPoint
rsrc comdlg32
import winspool.drv
import shell32.dll
import comctl32.dll
...
...
@@ -23,7 +24,7 @@ import winspool.drv
13 stdcall GetSaveFileNameW(ptr) GetSaveFileNameW
14 stub LoadAlterBitmap
15 stdcall PageSetupDlgA(ptr) PageSetupDlgA
16 st
ub
PageSetupDlgW
16 st
dcall PageSetupDlgW(ptr)
PageSetupDlgW
17 stdcall PrintDlgA(ptr) PrintDlgA
18 stdcall PrintDlgW(ptr) PrintDlgW
19 stdcall ReplaceTextA(ptr) ReplaceTextA
...
...
dlls/commdlg/filedlg.c
View file @
b40a9b7f
...
...
@@ -46,6 +46,12 @@ static const char defaultfilter[]=" \0\0";
* Windows 3.1 OpenFileName/SaveFileName dialog
*
*/
LRESULT
WINAPI
FileOpenDlgProc16
(
HWND16
hWnd
,
UINT16
wMsg
,
WPARAM16
wParam
,
LPARAM
lParam
);
LRESULT
WINAPI
FileSaveDlgProc16
(
HWND16
hWnd
,
UINT16
wMsg
,
WPARAM16
wParam
,
LPARAM
lParam
);
/***********************************************************************
* FileDlg_Init [internal]
*/
...
...
dlls/commdlg/finddlg.c
View file @
b40a9b7f
...
...
@@ -23,6 +23,11 @@ DEFAULT_DEBUG_CHANNEL(commdlg)
#include "cdlg.h"
LRESULT
WINAPI
FindTextDlgProc16
(
HWND16
hWnd
,
UINT16
wMsg
,
WPARAM16
wParam
,
LPARAM
lParam
);
LRESULT
WINAPI
ReplaceTextDlgProc16
(
HWND16
hWnd
,
UINT16
wMsg
,
WPARAM16
wParam
,
LPARAM
lParam
);
/***********************************************************************
* FindTextDlgProc [internal]
*
...
...
dlls/commdlg/fontdlg.c
View file @
b40a9b7f
...
...
@@ -32,6 +32,10 @@ DEFAULT_DEBUG_CHANNEL(commdlg);
static
HBITMAP16
hBitmapTT
=
0
;
LRESULT
WINAPI
FormatCharDlgProcA
(
HWND
hDlg
,
UINT
uMsg
,
WPARAM
wParam
,
LPARAM
lParam
);
LRESULT
WINAPI
FormatCharDlgProcW
(
HWND
hDlg
,
UINT
uMsg
,
WPARAM
wParam
,
LPARAM
lParam
);
static
void
CFn_CHOOSEFONT16to32A
(
LPCHOOSEFONT16
chf16
,
LPCHOOSEFONTA
chf32a
)
...
...
dlls/commdlg/printdlg.c
View file @
b40a9b7f
...
...
@@ -4,8 +4,8 @@
* Copyright 1994 Martin Ayotte
* Copyright 1996 Albrecht Kleine
* Copyright 1999 Klaas van Gend
* Copyright 2000 Huw D M Davies
*/
#include <ctype.h>
#include <stdlib.h>
#include <stdio.h>
...
...
@@ -13,11 +13,11 @@
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "wine/winbase16.h"
#include "wine/wingdi16.h"
#include "winuser.h"
#include "wine/winuser16.h"
#include "ldt.h"
#include "commdlg.h"
#include "dialog.h"
#include "dlgs.h"
#include "module.h"
#include "debugtools.h"
...
...
@@ -37,11 +37,9 @@ DEFAULT_DEBUG_CHANNEL(commdlg);
*/
typedef
struct
{
LPPRINTER_INFO_2A
lpPrinterInfo
;
UINT
CurrentPrinter
;
/* used as lpPrinterInfo[CurrentPrinter] */
UINT
DefaultPrinter
;
/* used as lpPrinterInfo[DefaultPrinter] */
DWORD
NrOfPrinterInfoEntries
;
LPDEVMODEA
lpDevMode
;
LPPRINTDLGA
lpPrintDlg
;
LPPRINTER_INFO_2A
lpPrinterInfo
;
UINT
HelpMessageID
;
HICON
hCollateIcon
;
/* PrintDlg only */
HICON
hNoCollateIcon
;
/* PrintDlg only */
...
...
@@ -49,292 +47,359 @@ typedef struct
HICON
hLandscapeIcon
;
/* PrintSetupDlg only */
}
PRINT_PTRA
;
/* Debugiging info */
static
struct
pd_flags
{
DWORD
flag
;
LPSTR
name
;
}
pd_flags
[]
=
{
{
PD_SELECTION
,
"PD_SELECTION "
},
{
PD_PAGENUMS
,
"PD_PAGENUMS "
},
{
PD_NOSELECTION
,
"PD_NOSELECTION "
},
{
PD_NOPAGENUMS
,
"PD_NOPAGENUMS "
},
{
PD_COLLATE
,
"PD_COLLATE "
},
{
PD_PRINTTOFILE
,
"PD_PRINTTOFILE "
},
{
PD_PRINTSETUP
,
"PD_PRINTSETUP "
},
{
PD_NOWARNING
,
"PD_NOWARNING "
},
{
PD_RETURNDC
,
"PD_RETURNDC "
},
{
PD_RETURNIC
,
"PD_RETURNIC "
},
{
PD_RETURNDEFAULT
,
"PD_RETURNDEFAULT "
},
{
PD_SHOWHELP
,
"PD_SHOWHELP "
},
{
PD_ENABLEPRINTHOOK
,
"PD_ENABLEPRINTHOOK "
},
{
PD_ENABLESETUPHOOK
,
"PD_ENABLESETUPHOOK "
},
{
PD_ENABLEPRINTTEMPLATE
,
"PD_ENABLEPRINTTEMPLATE "
},
{
PD_ENABLESETUPTEMPLATE
,
"PD_ENABLESETUPTEMPLATE "
},
{
PD_ENABLEPRINTTEMPLATEHANDLE
,
"PD_ENABLEPRINTTEMPLATEHANDLE "
},
{
PD_ENABLESETUPTEMPLATEHANDLE
,
"PD_ENABLESETUPTEMPLATEHANDLE "
},
{
PD_USEDEVMODECOPIES
,
"PD_USEDEVMODECOPIES[ANDCOLLATE] "
},
{
PD_DISABLEPRINTTOFILE
,
"PD_DISABLEPRINTTOFILE "
},
{
PD_HIDEPRINTTOFILE
,
"PD_HIDEPRINTTOFILE "
},
{
PD_NONETWORKBUTTON
,
"PD_NONETWORKBUTTON "
},
{
-
1
,
NULL
}
};
/* prototypes */
static
BOOL
PRINTDLG_ValidateAndDuplicateSettings
(
HWND
hDlg
,
PRINT_PTRA
*
PrintStructures
);
LRESULT
WINAPI
PrintSetupDlgProcA
(
HWND
hDlg
,
UINT
uMsg
,
WPARAM
wParam
,
LPARAM
lParam
);
/***********************************************************************
* PRINTDLG_GetDefaultPrinterName
*
* Returns the default printer name in buf.
* Even under WinNT/2000 default printer is retrieved via GetProfileString -
* these entries are mapped somewhere in the registry rather than win.ini.
*
* Returns TRUE on success else FALSE
*/
static
BOOL
PRINTDLG_GetDefaultPrinterName
(
LPSTR
buf
,
DWORD
len
)
{
char
*
ptr
;
if
(
!
GetProfileStringA
(
"windows"
,
"device"
,
""
,
buf
,
len
))
return
FALSE
;
if
((
ptr
=
strchr
(
buf
,
','
))
==
NULL
)
return
FALSE
;
*
ptr
=
'\0'
;
return
TRUE
;
}
/***********************************************************************
*
PrintDlg16 (COMMDLG.20)
*
PRINTDLG_OpenDefaultPrinter
*
*
Displays the the PRINT dialog box, which enables the user to specify
*
specific properties of the print job.
*
Returns a winspool printer handle to the default printer in *hprn
*
Caller must call ClosePrinter on the handle
*
* RETURNS
* nonzero if the user pressed the OK button
* zero if the user cancelled the window or an error occurred
* Returns TRUE on success else FALSE
*/
static
BOOL
PRINTDLG_OpenDefaultPrinter
(
HANDLE
*
hprn
)
{
char
buf
[
260
];
if
(
!
PRINTDLG_GetDefaultPrinterName
(
buf
,
sizeof
(
buf
)))
return
FALSE
;
return
OpenPrinterA
(
buf
,
hprn
,
NULL
);
}
/***********************************************************************
* PRINTDLG_SetUpPrinterListCombo
*
* BUGS
* * calls up to the 32-bit versions of the Dialogs, which look different
* * Customizing is *not* implemented.
* Initializes printer list combox.
* hDlg: HWND of dialog
* id: Control id of combo
* name: Name of printer to select
*
* Initializes combo with list of available printers. Selects printer 'name'
* If name is NULL or does not exist select the default printer.
*
* Returns number of printers added to list.
*/
BOOL16
WINAPI
PrintDlg16
(
LPPRINTDLG16
lpPrint
)
static
INT
PRINTDLG_SetUpPrinterListCombo
(
HWND
hDlg
,
UINT
id
,
LPCSTR
name
)
{
PRINTDLGA
Print32
;
BOOL16
ret
;
DWORD
needed
,
num
;
INT
i
;
LPPRINTER_INFO_2A
pi
;
EnumPrintersA
(
PRINTER_ENUM_LOCAL
,
NULL
,
2
,
NULL
,
0
,
&
needed
,
&
num
);
pi
=
HeapAlloc
(
GetProcessHeap
(),
0
,
needed
);
EnumPrintersA
(
PRINTER_ENUM_LOCAL
,
NULL
,
2
,
(
LPBYTE
)
pi
,
needed
,
&
needed
,
&
num
);
for
(
i
=
0
;
i
<
num
;
i
++
)
{
SendDlgItemMessageA
(
hDlg
,
id
,
CB_ADDSTRING
,
0
,
(
LPARAM
)
pi
[
i
].
pPrinterName
);
}
HeapFree
(
GetProcessHeap
(),
0
,
pi
);
if
(
!
name
||
(
i
=
SendDlgItemMessageA
(
hDlg
,
id
,
CB_FINDSTRINGEXACT
,
-
1
,
(
LPARAM
)
name
))
==
CB_ERR
)
{
char
buf
[
260
];
TRACE
(
"Can't find '%s' in printer list so trying to find default
\n
"
,
name
);
if
(
!
PRINTDLG_GetDefaultPrinterName
(
buf
,
sizeof
(
buf
)))
return
num
;
i
=
SendDlgItemMessageA
(
hDlg
,
id
,
CB_FINDSTRINGEXACT
,
-
1
,
(
LPARAM
)
buf
);
if
(
i
==
CB_ERR
)
TRACE
(
"Can't find default printer in printer list
\n
"
);
}
SendDlgItemMessageA
(
hDlg
,
id
,
CB_SETCURSEL
,
i
,
0
);
return
num
;
}
memset
(
&
Print32
,
0
,
sizeof
(
Print32
));
Print32
.
lStructSize
=
sizeof
(
Print32
);
Print32
.
hwndOwner
=
lpPrint
->
hwndOwner
;
Print32
.
hDevMode
=
lpPrint
->
hDevMode
;
Print32
.
hDevNames
=
lpPrint
->
hDevNames
;
Print32
.
Flags
=
lpPrint
->
Flags
;
Print32
.
nFromPage
=
lpPrint
->
nFromPage
;
Print32
.
nToPage
=
lpPrint
->
nToPage
;
Print32
.
nMinPage
=
lpPrint
->
nMinPage
;
Print32
.
nMaxPage
=
lpPrint
->
nMaxPage
;
Print32
.
nCopies
=
lpPrint
->
nCopies
;
Print32
.
hInstance
=
lpPrint
->
hInstance
;
Print32
.
lCustData
=
lpPrint
->
lCustData
;
if
(
lpPrint
->
lpfnPrintHook
)
{
FIXME
(
"Need to allocate thunk
\n
"
);
/* Print32.lpfnPrintHook = lpPrint->lpfnPrintHook;*/
}
if
(
lpPrint
->
lpfnSetupHook
)
{
FIXME
(
"Need to allocate thunk
\n
"
);
/* Print32.lpfnSetupHook = lpPrint->lpfnSetupHook;*/
}
Print32
.
lpPrintTemplateName
=
PTR_SEG_TO_LIN
(
lpPrint
->
lpPrintTemplateName
);
Print32
.
lpSetupTemplateName
=
PTR_SEG_TO_LIN
(
lpPrint
->
lpSetupTemplateName
);
Print32
.
hPrintTemplate
=
lpPrint
->
hPrintTemplate
;
Print32
.
hSetupTemplate
=
lpPrint
->
hSetupTemplate
;
/***********************************************************************
* PRINTDLG_CreateDevNames [internal]
*
*
* creates a DevNames structure.
*
* (NB. when we handle unicode the offsets will be in wchars).
*/
static
BOOL
PRINTDLG_CreateDevNames
(
HGLOBAL
*
hmem
,
char
*
DeviceDriverName
,
char
*
DeviceName
,
char
*
OutputPort
)
{
long
size
;
char
*
pDevNamesSpace
;
char
*
pTempPtr
;
LPDEVNAMES
lpDevNames
;
char
buf
[
260
];
ret
=
PrintDlgA
(
&
Print32
);
size
=
strlen
(
DeviceDriverName
)
+
1
+
strlen
(
DeviceName
)
+
1
+
strlen
(
OutputPort
)
+
1
+
sizeof
(
DEVNAMES
);
lpPrint
->
hDevMode
=
Print32
.
hDevMode
;
lpPrint
->
hDevNames
=
Print32
.
hDevNames
;
lpPrint
->
hDC
=
Print32
.
hDC
;
lpPrint
->
Flags
=
Print32
.
Flags
;
lpPrint
->
nFromPage
=
Print32
.
nFromPage
;
lpPrint
->
nToPage
=
Print32
.
nToPage
;
lpPrint
->
nCopies
=
Print32
.
nCopies
;
if
(
*
hmem
)
*
hmem
=
GlobalReAlloc
(
*
hmem
,
size
,
GMEM_MOVEABLE
);
else
*
hmem
=
GlobalAlloc
(
GMEM_MOVEABLE
,
size
);
if
(
*
hmem
==
0
)
return
FALSE
;
return
ret
;
}
pDevNamesSpace
=
GlobalLock
(
*
hmem
);
lpDevNames
=
(
LPDEVNAMES
)
pDevNamesSpace
;
pTempPtr
=
pDevNamesSpace
+
sizeof
(
DEVNAMES
);
strcpy
(
pTempPtr
,
DeviceDriverName
);
lpDevNames
->
wDriverOffset
=
pTempPtr
-
pDevNamesSpace
;
pTempPtr
+=
strlen
(
DeviceDriverName
)
+
1
;
strcpy
(
pTempPtr
,
DeviceName
);
lpDevNames
->
wDeviceOffset
=
pTempPtr
-
pDevNamesSpace
;
pTempPtr
+=
strlen
(
DeviceName
)
+
1
;
strcpy
(
pTempPtr
,
OutputPort
);
lpDevNames
->
wOutputOffset
=
pTempPtr
-
pDevNamesSpace
;
PRINTDLG_GetDefaultPrinterName
(
buf
,
sizeof
(
buf
));
lpDevNames
->
wDefault
=
(
strcmp
(
buf
,
DeviceName
)
==
0
)
?
1
:
0
;
GlobalUnlock
(
*
hmem
);
return
TRUE
;
}
/***********************************************************************
*
PrintDlgA (COMDLG32.17)
*
PRINTDLG_UpdatePrintDlg [internal]
*
* Displays the the PRINT dialog box, which enables the user to specify
* specific properties of the print job.
*
* RETURNS
* nonzero if the user pressed the OK button
* zero if the user cancelled the window or an error occurred
* updates the PrintDlg structure for returnvalues.
*
* BUGS
* PrintDlg:
* * The Collate Icons do not display, even though they are in the code.
* * The Properties Button(s) should call DocumentPropertiesA().
* PrintSetupDlg:
* * The Paper Orientation Icons are not implemented yet.
* * The Properties Button(s) should call DocumentPropertiesA().
* * Settings are not yet taken from a provided DevMode or
* default printer settings.
* RETURNS
* FALSE if user is not allowed to close (i.e. wrong nTo or nFrom values)
* TRUE if succesful.
*/
BOOL
WINAPI
PrintDlgA
(
LPPRINTDLGA
lppd
/* ptr to PRINTDLG32 struct */
)
static
BOOL
PRINTDLG_UpdatePrintDlg
(
HWND
hDlg
,
PRINT_PTRA
*
PrintStructures
)
{
/* My implementing strategy:
*
* step 1: display the dialog and implement the layout-flags
* step 2: enter valid information in the fields (e.g. real printers)
* step 3: fix the RETURN-TRUE-ALWAYS Fixme by checking lppd->Flags for
* PD_RETURNDEFAULT
* step 4: implement all other specs
* step 5: allow customisation of the dialog box
*
* current implementation is in step 4.
*/
LPPRINTDLGA
lppd
=
PrintStructures
->
lpPrintDlg
;
PDEVMODEA
lpdm
=
PrintStructures
->
lpDevMode
;
LPPRINTER_INFO_2A
pi
=
PrintStructures
->
lpPrinterInfo
;
HWND
hwndDialog
;
BOOL
bRet
=
FALSE
;
LPCVOID
ptr
;
HANDLE
hResInfo
,
hDlgTmpl
;
HINSTANCE
hInst
=
GetWindowLongA
(
lppd
->
hwndOwner
,
GWL_HINSTANCE
);
DWORD
EnumBytesNeeded
;
DWORD
CopyOfEnumBytesNeeded
;
PRINT_PTRA
PrintStructures
;
TRACE
(
"(lppd: %p)
\n
"
,
lppd
);
PrintStructures
.
lpPrintDlg
=
lppd
;
if
(
!
lpdm
)
return
FALSE
;
/* load Dialog resources,
* depending on Flags indicates Print32 or Print32_setup dialog
if
(
!
(
lppd
->
Flags
&
PD_PRINTSETUP
))
{
/* check whether nFromPage and nToPage are within range defined by
* nMinPage and nMaxPage
*/
if
(
lppd
->
Flags
&
PD_PRINTSETUP
)
hResInfo
=
FindResourceA
(
COMDLG32_hInstance
,
"PRINT32_SETUP"
,
RT_DIALOGA
);
else
hResInfo
=
FindResourceA
(
COMDLG32_hInstance
,
"PRINT32"
,
RT_DIALOGA
);
if
(
!
hResInfo
)
{
COMDLG32_SetCommDlgExtendedError
(
CDERR_FINDRESFAILURE
);
if
(
IsDlgButtonChecked
(
hDlg
,
rad3
)
==
BST_CHECKED
)
{
/* Pages */
WORD
nToPage
;
WORD
nFromPage
;
nFromPage
=
GetDlgItemInt
(
hDlg
,
edt1
,
NULL
,
FALSE
);
nToPage
=
GetDlgItemInt
(
hDlg
,
edt2
,
NULL
,
FALSE
);
if
(
nFromPage
<
lppd
->
nMinPage
||
nFromPage
>
lppd
->
nMaxPage
||
nToPage
<
lppd
->
nMinPage
||
nToPage
>
lppd
->
nMaxPage
)
{
char
resourcestr
[
256
];
char
resultstr
[
256
];
LoadStringA
(
COMDLG32_hInstance
,
PD32_INVALID_PAGE_RANGE
,
resourcestr
,
255
);
sprintf
(
resultstr
,
resourcestr
,
lppd
->
nMinPage
,
lppd
->
nMaxPage
);
LoadStringA
(
COMDLG32_hInstance
,
PD32_PRINT_TITLE
,
resourcestr
,
255
);
MessageBoxA
(
hDlg
,
resultstr
,
resourcestr
,
MB_OK
|
MB_ICONWARNING
);
return
FALSE
;
}
if
(
!
(
hDlgTmpl
=
LoadResource
(
COMDLG32_hInstance
,
hResInfo
))
||
!
(
ptr
=
LockResource
(
hDlgTmpl
)))
{
COMDLG32_SetCommDlgExtendedError
(
CDERR_LOADRESFAILURE
);
return
FALSE
;
lppd
->
nFromPage
=
nFromPage
;
lppd
->
nToPage
=
nToPage
;
}
/* load Collate ICONs */
PrintStructures
.
hCollateIcon
=
LoadIconA
(
COMDLG32_hInstance
,
"PD32_COLLATE"
);
PrintStructures
.
hNoCollateIcon
=
LoadIconA
(
COMDLG32_hInstance
,
"PD32_NOCOLLATE"
);
if
(
PrintStructures
.
hCollateIcon
==
0
||
PrintStructures
.
hNoCollateIcon
==
0
)
{
ERR
(
"no icon in resourcefile???"
);
COMDLG32_SetCommDlgExtendedError
(
CDERR_LOADRESFAILURE
);
return
FALSE
;
if
(
IsDlgButtonChecked
(
hDlg
,
chx1
)
==
BST_CHECKED
)
{
/* Print to file */
lppd
->
Flags
|=
PD_PRINTTOFILE
;
pi
->
pPortName
=
"FILE:"
;
}
/* load Paper Orientation ICON */
/* FIXME: not implemented yet */
/*
* if lppd->Flags PD_SHOWHELP is specified, a HELPMESGSTRING message
* must be registered and the Help button must be shown.
*/
if
(
lppd
->
Flags
&
PD_SHOWHELP
)
{
if
((
PrintStructures
.
HelpMessageID
=
RegisterWindowMessageA
(
HELPMSGSTRING
))
==
0
)
{
COMDLG32_SetCommDlgExtendedError
(
CDERR_REGISTERMSGFAIL
);
return
FALSE
;
}
if
(
IsDlgButtonChecked
(
hDlg
,
chx2
)
==
BST_CHECKED
)
{
/* Collate */
FIXME
(
"Collate lppd not yet implemented as output
\n
"
);
}
else
PrintStructures
.
HelpMessageID
=
0
;
/* Use EnumPrinters to obtain a list of PRINTER_INFO_2A's
* and store a pointer to this list in our "global structure"
* as reference for the rest of the PrintDlg routines
/* set PD_Collate and nCopies */
if
(
lppd
->
Flags
&
PD_USEDEVMODECOPIESANDCOLLATE
)
{
/* The application doesn't support multiple copies or collate...
*/
EnumPrintersA
(
PRINTER_ENUM_LOCAL
,
NULL
,
2
,
NULL
,
0
,
&
EnumBytesNeeded
,
&
PrintStructures
.
NrOfPrinterInfoEntries
);
CopyOfEnumBytesNeeded
=
EnumBytesNeeded
+
16
;
PrintStructures
.
lpPrinterInfo
=
malloc
(
CopyOfEnumBytesNeeded
*
sizeof
(
char
));
EnumPrintersA
(
PRINTER_ENUM_LOCAL
,
NULL
,
2
,
(
LPBYTE
)
PrintStructures
.
lpPrinterInfo
,
CopyOfEnumBytesNeeded
,
&
EnumBytesNeeded
,
&
PrintStructures
.
NrOfPrinterInfoEntries
);
/* Find the default printer.
* If not: display a warning message (unless PD_NOWARNING specified)
* and return PDERR_NODEFAULTPRN
lppd
->
Flags
&=
~
PD_COLLATE
;
lppd
->
nCopies
=
1
;
/* if the printer driver supports it... store info there
* otherwise no collate & multiple copies !
*/
/* FIXME: not implemented yet!!! */
if
(
!
PrintStructures
.
NrOfPrinterInfoEntries
)
{
COMDLG32_SetCommDlgExtendedError
(
PDERR_NODEFAULTPRN
);
return
FALSE
;
if
(
lpdm
->
dmFields
&
DM_COLLATE
)
lpdm
->
dmCollate
=
(
IsDlgButtonChecked
(
hDlg
,
chx2
)
==
BST_CHECKED
);
if
(
lpdm
->
dmFields
&
DM_COPIES
)
lpdm
->
dmCopies
=
GetDlgItemInt
(
hDlg
,
edt3
,
NULL
,
FALSE
);
}
else
{
if
(
IsDlgButtonChecked
(
hDlg
,
chx2
)
==
BST_CHECKED
)
lppd
->
Flags
|=
PD_COLLATE
;
else
lppd
->
Flags
&=
~
PD_COLLATE
;
lppd
->
nCopies
=
GetDlgItemInt
(
hDlg
,
edt3
,
NULL
,
FALSE
);
}
PrintStructures
.
CurrentPrinter
=
0
;
PrintStructures
.
DefaultPrinter
=
0
;
/* FIXME: Currently Unimplemented */
if
(
lppd
->
Flags
&
PD_NOWARNING
)
{
COMDLG32_SetCommDlgExtendedError
(
PDERR_INITFAILURE
);
WARN
(
": PD_NOWARNING Flag is not yet implemented.
\n
"
);
}
return
TRUE
;
}
/*
* FIXME : Should respond to TEMPLATE and HOOK flags here
* For now, only the standard dialog works.
*/
if
(
lppd
->
Flags
&
(
PD_ENABLEPRINTHOOK
|
PD_ENABLEPRINTTEMPLATE
|
PD_ENABLEPRINTTEMPLATEHANDLE
|
PD_ENABLESETUPHOOK
|
PD_ENABLESETUPTEMPLATE
|
PD_ENABLESETUPTEMPLATEHANDLE
))
FIXME
(
": unimplemented flag (ignored)
\n
"
);
/*
* if lppd->Flags PD_RETURNDEFAULT is specified, the PrintDlg function
* does not display the dialog box, but returns with valid entries
* for hDevMode and hDevNames .
/************************************************************************
* PRINTDLG_SetUpPaperComboBox
*
* According to MSDN, it is required that hDevMode and hDevNames equal
* zero if this flag is set.
* Initialize either the papersize or inputslot combos of the Printer Setup
* dialog. We store the associated word (eg DMPAPER_A4) as the item data.
* We also try to re-select the old selection.
*/
if
(
lppd
->
Flags
&
PD_RETURNDEFAULT
)
{
TRACE
(
" PD_RETURNDEFAULT: was requested to return printer info only.
\n
"
);
if
(
lppd
->
hDevMode
!=
0
||
lppd
->
hDevNames
!=
0
)
{
COMDLG32_SetCommDlgExtendedError
(
PDERR_INITFAILURE
);
return
(
FALSE
);
static
BOOL
PRINTDLG_SetUpPaperComboBox
(
HWND
hDlg
,
int
nIDComboBox
,
char
*
PrinterName
,
char
*
PortName
,
LPDEVMODEA
dm
)
{
int
i
;
DWORD
NrOfEntries
;
char
*
Names
;
WORD
*
Words
;
DWORD
Sel
;
WORD
oldWord
=
0
;
int
NamesSize
;
int
fwCapability_Names
;
int
fwCapability_Words
;
TRACE
(
" Printer: %s, ComboID: %d
\n
"
,
PrinterName
,
nIDComboBox
);
/* query the dialog box for the current selected value */
Sel
=
SendDlgItemMessageA
(
hDlg
,
nIDComboBox
,
CB_GETCURSEL
,
0
,
0
);
if
(
Sel
!=
CB_ERR
)
{
oldWord
=
SendDlgItemMessageA
(
hDlg
,
nIDComboBox
,
CB_GETITEMDATA
,
Sel
,
0
);
}
return
(
PRINTDLG_ValidateAndDuplicateSettings
(
0
,
&
PrintStructures
));
if
(
nIDComboBox
==
cmb2
)
{
NamesSize
=
64
;
fwCapability_Names
=
DC_PAPERNAMES
;
fwCapability_Words
=
DC_PAPERS
;
}
else
{
nIDComboBox
=
cmb3
;
NamesSize
=
24
;
fwCapability_Names
=
DC_BINNAMES
;
fwCapability_Words
=
DC_BINS
;
}
/* and create & process the dialog
/* for some printer drivers, DeviceCapabilities calls a VXD to obtain the
* paper settings. As Wine doesn't allow VXDs, this results in a crash.
*/
if
(
lppd
->
Flags
&
PD_PRINTSETUP
)
{
hwndDialog
=
DIALOG_CreateIndirect
(
hInst
,
ptr
,
TRUE
,
lppd
->
hwndOwner
,
(
DLGPROC16
)
PrintSetupDlgProcA
,
(
LPARAM
)
&
PrintStructures
,
WIN_PROC_32A
);
}
else
{
hwndDialog
=
DIALOG_CreateIndirect
(
hInst
,
ptr
,
TRUE
,
lppd
->
hwndOwner
,
(
DLGPROC16
)
PrintDlgProcA
,
(
LPARAM
)
&
PrintStructures
,
WIN_PROC_32A
);
WARN
(
" if your printer driver uses VXDs, expect a crash now!
\n
"
);
NrOfEntries
=
DeviceCapabilitiesA
(
PrinterName
,
PortName
,
fwCapability_Names
,
NULL
,
dm
);
if
(
NrOfEntries
==
0
)
WARN
(
"no Name Entries found!
\n
"
);
if
(
DeviceCapabilitiesA
(
PrinterName
,
PortName
,
fwCapability_Words
,
NULL
,
dm
)
!=
NrOfEntries
)
{
ERR
(
"Number of caps is different
\n
"
);
NrOfEntries
=
0
;
}
if
(
hwndDialog
)
bRet
=
DIALOG_DoDialogBox
(
hwndDialog
,
lppd
->
hwndOwner
);
/* free memory & resources
*/
free
(
PrintStructures
.
lpPrinterInfo
);
DeleteObject
(
PrintStructures
.
hCollateIcon
);
DeleteObject
(
PrintStructures
.
hNoCollateIcon
);
/* FIXME: don't forget to delete the paper orientation icons here! */
Names
=
HeapAlloc
(
GetProcessHeap
(),
0
,
NrOfEntries
*
NamesSize
);
Words
=
HeapAlloc
(
GetProcessHeap
(),
0
,
NrOfEntries
*
sizeof
(
WORD
));
NrOfEntries
=
DeviceCapabilitiesA
(
PrinterName
,
PortName
,
fwCapability_Names
,
Names
,
dm
);
NrOfEntries
=
DeviceCapabilitiesA
(
PrinterName
,
PortName
,
fwCapability_Words
,
(
LPSTR
)
Words
,
dm
);
TRACE
(
" exit! (%d)"
,
bRet
);
return
bRet
;
}
/* reset any current content in the combobox */
SendDlgItemMessageA
(
hDlg
,
nIDComboBox
,
CB_RESETCONTENT
,
0
,
0
);
/* store new content */
for
(
i
=
0
;
i
<
NrOfEntries
;
i
++
)
{
DWORD
pos
=
SendDlgItemMessageA
(
hDlg
,
nIDComboBox
,
CB_ADDSTRING
,
0
,
(
LPARAM
)(
&
Names
[
i
*
NamesSize
])
);
SendDlgItemMessageA
(
hDlg
,
nIDComboBox
,
CB_SETITEMDATA
,
pos
,
Words
[
i
]);
}
/* Look for old selection - can't do this is previous loop since
item order will change as more items are added */
Sel
=
0
;
for
(
i
=
0
;
i
<
NrOfEntries
;
i
++
)
{
if
(
SendDlgItemMessageA
(
hDlg
,
nIDComboBox
,
CB_GETITEMDATA
,
i
,
0
)
==
oldWord
)
{
Sel
=
i
;
break
;
}
}
SendDlgItemMessageA
(
hDlg
,
nIDComboBox
,
CB_SETCURSEL
,
Sel
,
0
);
/***********************************************************************
* PrintDlgW (COMDLG32.18)
*/
BOOL
WINAPI
PrintDlgW
(
LPPRINTDLGW
printdlg
)
{
FIXME
(
"A really empty stub
\n
"
);
return
FALSE
;
HeapFree
(
GetProcessHeap
(),
0
,
Words
);
HeapFree
(
GetProcessHeap
(),
0
,
Names
);
return
TRUE
;
}
/***********************************************************************
* PRINTDLG_UpdatePrinterInfoTexts [internal]
*/
static
void
PRINTDLG_UpdatePrinterInfoTexts
(
HWND
hDlg
,
PRINT_PTRA
*
PrintStructures
)
static
void
PRINTDLG_UpdatePrinterInfoTexts
(
HWND
hDlg
,
LPPRINTER_INFO_2A
pi
)
{
char
StatusMsg
[
256
];
char
ResourceString
[
256
];
int
i
;
LPPRINTER_INFO_2A
lpPi
=
&
(
PrintStructures
->
lpPrinterInfo
[
PrintStructures
->
CurrentPrinter
]);
/* Status Message */
StatusMsg
[
0
]
=
'\0'
;
/* FIXME: if default printer, add this first */
;
/* add all status messages */
for
(
i
=
0
;
i
<
25
;
i
++
)
{
if
(
lpPi
->
Status
&
(
1
<<
i
))
{
for
(
i
=
0
;
i
<
25
;
i
++
)
{
if
(
pi
->
Status
&
(
1
<<
i
))
{
LoadStringA
(
COMDLG32_hInstance
,
PD32_PRINTER_STATUS_PAUSED
+
i
,
ResourceString
,
255
);
strcat
(
StatusMsg
,
ResourceString
);
...
...
@@ -342,7 +407,7 @@ static void PRINTDLG_UpdatePrinterInfoTexts(HWND hDlg, PRINT_PTRA* PrintStructur
}
/* append "ready" */
/* FIXME: status==ready must only be appended if really so.
but how to detect?
??
*/
but how to detect? */
LoadStringA
(
COMDLG32_hInstance
,
PD32_PRINTER_STATUS_READY
,
ResourceString
,
255
);
strcat
(
StatusMsg
,
ResourceString
);
...
...
@@ -350,192 +415,70 @@ static void PRINTDLG_UpdatePrinterInfoTexts(HWND hDlg, PRINT_PTRA* PrintStructur
SendDlgItemMessageA
(
hDlg
,
stc12
,
WM_SETTEXT
,
0
,
(
LPARAM
)
StatusMsg
);
/* set all other printer info texts */
SendDlgItemMessageA
(
hDlg
,
stc11
,
WM_SETTEXT
,
0
,
(
LPARAM
)
lpP
i
->
pDriverName
);
if
(
lpPi
->
pLocation
!=
NULL
&&
lpPi
->
pLocation
[
0
]
!=
'\0'
)
SendDlgItemMessageA
(
hDlg
,
stc14
,
WM_SETTEXT
,
0
,(
LPARAM
)
lpP
i
->
pLocation
);
SendDlgItemMessageA
(
hDlg
,
stc11
,
WM_SETTEXT
,
0
,
(
LPARAM
)
p
i
->
pDriverName
);
if
(
pi
->
pLocation
!=
NULL
&&
pi
->
pLocation
[
0
]
!=
'\0'
)
SendDlgItemMessageA
(
hDlg
,
stc14
,
WM_SETTEXT
,
0
,(
LPARAM
)
p
i
->
pLocation
);
else
SendDlgItemMessageA
(
hDlg
,
stc14
,
WM_SETTEXT
,
0
,(
LPARAM
)
lpPi
->
pPortName
);
SendDlgItemMessageA
(
hDlg
,
stc13
,
WM_SETTEXT
,
0
,
(
LPARAM
)
lpPi
->
pComment
);
SendDlgItemMessageA
(
hDlg
,
stc14
,
WM_SETTEXT
,
0
,(
LPARAM
)
pi
->
pPortName
);
SendDlgItemMessageA
(
hDlg
,
stc13
,
WM_SETTEXT
,
0
,
(
LPARAM
)
pi
->
pComment
);
return
;
}
/***********************************************************************
* PRINTSETUP32DLG_ComboBox [internal]
*
* Queries the DeviceCapabilities for a list of paper sizes / bin names
* and stores these in combobox cmb2 / cmb3.
* If there was already an item selected in the listbox,
* this item is looked up in the new list and reselected,
* the accompanying ID (for BinNames, this is the dmDefaultSource value)
* is returned
*
* If any entries in the listbox existed, these are deleted
*
* RETURNS:
* If an entry was selected and also exists in the new list,
* its corresponding ID is returned.
/*******************************************************************
*
*
returns zero on not found, error or SelectedName==NULL.
*
PRINTDLG_ChangePrinter
*
*
* BUGS:
* * the lookup of a new entry shouldn't be done on stringname,
* but on ID value, as some drivers name the same paper format
* differently (language differences, added paper size)
*/
static
short
PRINTSETUP32DLG_UpdateComboBox
(
HWND
hDlg
,
int
nIDComboBox
,
char
*
PrinterName
,
char
*
PortName
)
static
BOOL
PRINTDLG_ChangePrinter
(
HWND
hDlg
,
char
*
name
,
PRINT_PTRA
*
PrintStructures
)
{
int
i
;
DWORD
NrOfEntries
;
char
*
Names
;
WORD
*
Sizes
;
HGLOBAL
hTempMem
;
short
returnvalue
=
0
;
char
SelectedName
[
256
];
int
NamesSize
;
int
fwCapability_Names
;
int
fwCapability_Words
;
TRACE
(
" Printer: %s, ComboID: %d
\n
"
,
PrinterName
,
nIDComboBox
);
/* query the dialog box for the current selected value */
GetDlgItemTextA
(
hDlg
,
nIDComboBox
,
SelectedName
,
255
);
if
(
nIDComboBox
==
cmb2
)
{
NamesSize
=
64
;
fwCapability_Names
=
DC_PAPERNAMES
;
fwCapability_Words
=
DC_PAPERS
;
}
else
{
nIDComboBox
=
cmb3
;
NamesSize
=
24
;
fwCapability_Names
=
DC_BINNAMES
;
fwCapability_Words
=
DC_BINS
;
}
/* for some printer drivers, DeviceCapabilities calls a VXD to obtain the
* paper settings. As Wine doesn't allow VXDs, this results in a crash.
*/
WARN
(
" if your printer driver uses VXDs, expect a crash now!
\n
"
);
NrOfEntries
=
DeviceCapabilitiesA
(
PrinterName
,
PortName
,
fwCapability_Names
,
NULL
,
NULL
);
if
(
NrOfEntries
==
0
)
{
WARN
(
" no Name Entries found!
\n
"
);
}
hTempMem
=
GlobalAlloc
(
GMEM_MOVEABLE
,
NrOfEntries
*
NamesSize
);
if
(
hTempMem
==
0
)
{
ERR
(
" Not enough memory to store Paper Size Names!
\n
"
);
return
(
0
);
}
Names
=
GlobalLock
(
hTempMem
);
NrOfEntries
=
DeviceCapabilitiesA
(
PrinterName
,
PortName
,
fwCapability_Names
,
Names
,
NULL
);
/* reset any current content in the combobox */
SendDlgItemMessageA
(
hDlg
,
nIDComboBox
,
CB_RESETCONTENT
,
0
,
0
);
/* store new content */
for
(
i
=
0
;
i
<
NrOfEntries
;
i
++
)
{
SendDlgItemMessageA
(
hDlg
,
nIDComboBox
,
CB_ADDSTRING
,
0
,
(
LPARAM
)(
&
Names
[
i
*
NamesSize
])
);
LPPRINTDLGA
lppd
=
PrintStructures
->
lpPrintDlg
;
LPDEVMODEA
lpdm
=
NULL
;
LONG
dmSize
;
DWORD
needed
;
HANDLE
hprn
;
if
(
PrintStructures
->
lpPrinterInfo
)
HeapFree
(
GetProcessHeap
(),
0
,
PrintStructures
->
lpPrinterInfo
);
if
(
!
OpenPrinterA
(
name
,
&
hprn
,
NULL
))
{
ERR
(
"Can't open printer %s
\n
"
,
name
);
return
FALSE
;
}
GetPrinterA
(
hprn
,
2
,
NULL
,
0
,
&
needed
);
PrintStructures
->
lpPrinterInfo
=
HeapAlloc
(
GetProcessHeap
(),
0
,
needed
);
GetPrinterA
(
hprn
,
2
,
(
LPBYTE
)
PrintStructures
->
lpPrinterInfo
,
needed
,
&
needed
);
ClosePrinter
(
hprn
);
/* select first entry */
SendDlgItemMessageA
(
hDlg
,
nIDComboBox
,
CB_SELECTSTRING
,
0
,
(
LPARAM
)(
&
Names
[
0
])
);
/* lookup SelectedName and select it, if found */
if
(
SelectedName
[
0
]
!=
'\0'
)
{
for
(
i
=
0
;
i
<
NrOfEntries
;
i
++
)
{
if
(
strcmp
(
&
Names
[
i
*
NamesSize
],
SelectedName
)
==
0
)
{
SendDlgItemMessageA
(
hDlg
,
nIDComboBox
,
CB_SELECTSTRING
,
0
,
(
LPARAM
)(
SelectedName
));
PRINTDLG_UpdatePrinterInfoTexts
(
hDlg
,
PrintStructures
->
lpPrinterInfo
);
/* now, we need the i-th entry from the list of paper sizes */
/* let's recycle the memory */
DeviceCapabilitiesA
(
PrinterName
,
PortName
,
fwCapability_Words
,
Names
,
NULL
);
Sizes
=
(
WORD
*
)
Names
;
returnvalue
=
Sizes
[
i
];
break
;
/* quit for loop */
}
if
(
PrintStructures
->
lpDevMode
)
{
HeapFree
(
GetProcessHeap
(),
0
,
PrintStructures
->
lpDevMode
);
PrintStructures
->
lpDevMode
=
NULL
;
}
}
GlobalUnlock
(
hTempMem
);
GlobalFree
(
hTempMem
);
return
(
returnvalue
);
}
/***********************************************************************
* PRINTDLG_WMInitDialog [internal]
*/
static
LRESULT
PRINTDLG_WMInitDialog
(
HWND
hDlg
,
WPARAM
wParam
,
LPARAM
lParam
,
PRINT_PTRA
*
PrintStructures
)
{
int
i
;
LPPRINTDLGA
lppd
=
PrintStructures
->
lpPrintDlg
;
LPPRINTER_INFO_2A
lppi
=
PrintStructures
->
lpPrinterInfo
;
PDEVMODEA
pDevMode
=
lppi
[
PrintStructures
->
CurrentPrinter
].
pDevMode
;
SetWindowLongA
(
hDlg
,
DWL_USER
,
lParam
);
TRACE
(
"WM_INITDIALOG lParam=%08lX
\n
"
,
lParam
);
if
(
lppd
->
lStructSize
!=
sizeof
(
PRINTDLGA
))
{
FIXME
(
"structure size failure !!!
\n
"
);
/* EndDialog (hDlg, 0);
dmSize
=
DocumentPropertiesA
(
0
,
0
,
name
,
NULL
,
NULL
,
0
);
if
(
dmSize
==
-
1
)
{
ERR
(
"DocumentProperties fails on %s
\n
"
,
debugstr_a
(
name
));
return
FALSE
;
*/
}
}
PrintStructures
->
lpDevMode
=
HeapAlloc
(
GetProcessHeap
(),
0
,
dmSize
);
dmSize
=
DocumentPropertiesA
(
0
,
0
,
name
,
PrintStructures
->
lpDevMode
,
NULL
,
DM_OUT_BUFFER
);
if
(
lppd
->
hDevMode
&&
(
lpdm
=
GlobalLock
(
lppd
->
hDevMode
))
&&
!
strcmp
(
lpdm
->
dmDeviceName
,
PrintStructures
->
lpDevMode
->
dmDeviceName
))
{
/* Supplied devicemode matches current printer so try to use it */
DocumentPropertiesA
(
0
,
0
,
name
,
PrintStructures
->
lpDevMode
,
lpdm
,
DM_OUT_BUFFER
|
DM_IN_BUFFER
);
}
if
(
lpdm
)
GlobalUnlock
(
lppd
->
hDevMode
);
/* Fill Combobox according to info from PRINTER_INFO2A
* structure inside PrintStructures,
* select the default printer and generate an
* update-message to have the rest of the dialog box updated.
*/
for
(
i
=
0
;
i
<
PrintStructures
->
NrOfPrinterInfoEntries
;
i
++
)
SendDlgItemMessageA
(
hDlg
,
cmb4
,
CB_ADDSTRING
,
0
,
(
LPARAM
)
lppi
[
i
].
pPrinterName
);
i
=
SendDlgItemMessageA
(
hDlg
,
cmb4
,
CB_SELECTSTRING
,
(
WPARAM
)
-
1
,
(
LPARAM
)
lppi
[
PrintStructures
->
CurrentPrinter
].
pPrinterName
);
SendDlgItemMessageA
(
hDlg
,
cmb4
,
CB_SETCURSEL
,
(
WPARAM
)
i
,
(
LPARAM
)
0
);
PRINTDLG_UpdatePrinterInfoTexts
(
hDlg
,
PrintStructures
);
/* Flag processing to set the according buttons on/off and
* Initialise the various values
*/
lpdm
=
PrintStructures
->
lpDevMode
;
/* use this as a shortcut */
if
(
!
(
lppd
->
Flags
&
PD_PRINTSETUP
))
{
/* Print range (All/Range/Selection) */
/* FIXME: I allow more freedom than either Win95 or WinNT,
* which do not agree to what errors should be thrown or not
* in case nToPage or nFromPage is out-of-range.
*/
if
(
lppd
->
nMaxPage
<
lppd
->
nMinPage
)
lppd
->
nMaxPage
=
lppd
->
nMinPage
;
if
(
lppd
->
nMinPage
==
lppd
->
nMaxPage
)
lppd
->
Flags
|=
PD_NOPAGENUMS
;
if
(
lppd
->
nToPage
<
lppd
->
nMinPage
)
lppd
->
nToPage
=
lppd
->
nMinPage
;
if
(
lppd
->
nToPage
>
lppd
->
nMaxPage
)
lppd
->
nToPage
=
lppd
->
nMaxPage
;
if
(
lppd
->
nFromPage
<
lppd
->
nMinPage
)
lppd
->
nFromPage
=
lppd
->
nMinPage
;
if
(
lppd
->
nFromPage
>
lppd
->
nMaxPage
)
lppd
->
nFromPage
=
lppd
->
nMaxPage
;
SetDlgItemInt
(
hDlg
,
edt1
,
lppd
->
nFromPage
,
FALSE
);
SetDlgItemInt
(
hDlg
,
edt2
,
lppd
->
nToPage
,
FALSE
);
CheckRadioButton
(
hDlg
,
rad1
,
rad3
,
rad1
);
/* default */
...
...
@@ -544,16 +487,13 @@ static LRESULT PRINTDLG_WMInitDialog(HWND hDlg, WPARAM wParam, LPARAM lParam,
else
if
(
lppd
->
Flags
&
PD_SELECTION
)
CheckRadioButton
(
hDlg
,
rad1
,
rad3
,
rad2
);
if
(
lppd
->
Flags
&
PD_NOPAGENUMS
)
{
if
(
lppd
->
Flags
&
PD_NOPAGENUMS
)
{
EnableWindow
(
GetDlgItem
(
hDlg
,
rad3
),
FALSE
);
EnableWindow
(
GetDlgItem
(
hDlg
,
stc2
),
FALSE
);
EnableWindow
(
GetDlgItem
(
hDlg
,
edt1
),
FALSE
);
EnableWindow
(
GetDlgItem
(
hDlg
,
stc3
),
FALSE
);
EnableWindow
(
GetDlgItem
(
hDlg
,
edt2
),
FALSE
);
}
else
{
}
else
{
if
(
lppd
->
Flags
&
PD_PAGENUMS
)
CheckRadioButton
(
hDlg
,
rad1
,
rad3
,
rad3
);
}
...
...
@@ -571,25 +511,19 @@ static LRESULT PRINTDLG_WMInitDialog(HWND hDlg, WPARAM wParam, LPARAM lParam,
*
* FIXME: The ico3 is not displayed for some reason. I don't know why.
*/
if
(
lppd
->
Flags
&
PD_COLLATE
)
{
if
(
lppd
->
Flags
&
PD_COLLATE
)
{
SendDlgItemMessageA
(
hDlg
,
ico3
,
STM_SETIMAGE
,
(
WPARAM
)
IMAGE_ICON
,
(
LPARAM
)
PrintStructures
->
hCollateIcon
);
CheckDlgButton
(
hDlg
,
chx2
,
1
);
}
else
{
}
else
{
SendDlgItemMessageA
(
hDlg
,
ico3
,
STM_SETIMAGE
,
(
WPARAM
)
IMAGE_ICON
,
(
LPARAM
)
PrintStructures
->
hNoCollateIcon
);
CheckDlgButton
(
hDlg
,
chx2
,
0
);
}
if
(
lppd
->
Flags
&
PD_USEDEVMODECOPIESANDCOLLATE
||
lppd
->
Flags
&
PD_USEDEVMODECOPIES
)
{
if
(
lppd
->
Flags
&
PD_USEDEVMODECOPIESANDCOLLATE
)
{
/* if printer doesn't support it: no Collate */
if
(
!
(
pDevMode
->
dmFields
&
DM_COLLATE
))
{
if
(
!
(
lpdm
->
dmFields
&
DM_COLLATE
))
{
EnableWindow
(
GetDlgItem
(
hDlg
,
chx2
),
FALSE
);
EnableWindow
(
GetDlgItem
(
hDlg
,
ico3
),
FALSE
);
}
...
...
@@ -597,19 +531,13 @@ static LRESULT PRINTDLG_WMInitDialog(HWND hDlg, WPARAM wParam, LPARAM lParam,
/* nCopies */
if
(
lppd
->
hDevMode
==
0
)
{
SetDlgItemInt
(
hDlg
,
edt3
,
lppd
->
nCopies
,
FALSE
);
}
else
{
SetDlgItemInt
(
hDlg
,
edt1
,
pDevMode
->
dmCopies
,
FALSE
);
}
if
(
lppd
->
Flags
&
PD_USEDEVMODECOPIESANDCOLLATE
||
lppd
->
Flags
&
PD_USEDEVMODECOPIES
)
{
SetDlgItemInt
(
hDlg
,
edt3
,
lpdm
->
dmCopies
,
FALSE
);
if
(
lppd
->
Flags
&
PD_USEDEVMODECOPIESANDCOLLATE
)
{
/* if printer doesn't support it: no nCopies */
if
(
!
(
pDevMode
->
dmFields
&
DM_COPIES
))
{
if
(
!
(
lpdm
->
dmFields
&
DM_COPIES
))
{
EnableWindow
(
GetDlgItem
(
hDlg
,
edt3
),
FALSE
);
EnableWindow
(
GetDlgItem
(
hDlg
,
stc5
),
FALSE
);
}
...
...
@@ -622,561 +550,499 @@ static LRESULT PRINTDLG_WMInitDialog(HWND hDlg, WPARAM wParam, LPARAM lParam,
if
(
lppd
->
Flags
&
PD_HIDEPRINTTOFILE
)
ShowWindow
(
GetDlgItem
(
hDlg
,
chx1
),
SW_HIDE
);
}
else
{
/* PD_PRINTSETUP */
PRINTDLG_SetUpPaperComboBox
(
hDlg
,
cmb2
,
PrintStructures
->
lpPrinterInfo
->
pPrinterName
,
PrintStructures
->
lpPrinterInfo
->
pPortName
,
lpdm
);
PRINTDLG_SetUpPaperComboBox
(
hDlg
,
cmb3
,
PrintStructures
->
lpPrinterInfo
->
pPrinterName
,
PrintStructures
->
lpPrinterInfo
->
pPortName
,
lpdm
);
CheckRadioButton
(
hDlg
,
rad1
,
rad2
,
(
lpdm
->
u1
.
s1
.
dmOrientation
==
DMORIENT_PORTRAIT
)
?
rad1:
rad2
);
}
/* help button */
if
((
lppd
->
Flags
&
PD_SHOWHELP
)
==
0
)
{
/* hide if PD_SHOWHELP not specified */
if
((
lppd
->
Flags
&
PD_SHOWHELP
)
==
0
)
{
/* hide if PD_SHOWHELP not specified */
ShowWindow
(
GetDlgItem
(
hDlg
,
pshHelp
),
SW_HIDE
);
}
GlobalUnlock
(
lppd
->
hDevMode
);
return
TRUE
;
}
/***********************************************************************
* PRINTSETUP32DLG_WMInitDialog [internal]
*/
static
LRESULT
PRINTSETUP32DLG_WMInitDialog
(
HWND
hDlg
,
WPARAM
wParam
,
LPARAM
lParam
,
PRINT_PTRA
*
PrintStructures
)
{
int
i
;
LPPRINTDLGA
lppd
=
PrintStructures
->
lpPrintDlg
;
LPPRINTER_INFO_2A
lppi
=
PrintStructures
->
lpPrinterInfo
;
SetWindowLongA
(
hDlg
,
DWL_USER
,
lParam
);
TRACE
(
"WM_INITDIALOG lParam=%08lX
\n
"
,
lParam
);
if
(
lppd
->
lStructSize
!=
sizeof
(
PRINTDLGA
))
{
FIXME
(
"structure size failure !!!
\n
"
);
/* EndDialog (hDlg, 0);
return FALSE;
*/
}
/* Fill Combobox 1 according to info from PRINTER_INFO2A
* structure inside PrintStructures,
* select the default printer and generate an
* update-message to have the rest of the dialog box updated.
*/
for
(
i
=
0
;
i
<
PrintStructures
->
NrOfPrinterInfoEntries
;
i
++
)
SendDlgItemMessageA
(
hDlg
,
cmb1
,
CB_ADDSTRING
,
0
,
(
LPARAM
)
lppi
[
i
].
pPrinterName
);
i
=
SendDlgItemMessageA
(
hDlg
,
cmb1
,
CB_SELECTSTRING
,
(
WPARAM
)
-
1
,
(
LPARAM
)
lppi
[
PrintStructures
->
CurrentPrinter
].
pPrinterName
);
SendDlgItemMessageA
(
hDlg
,
cmb1
,
CB_SETCURSEL
,
(
WPARAM
)
i
,
(
LPARAM
)
0
);
PRINTDLG_UpdatePrinterInfoTexts
(
hDlg
,
PrintStructures
);
/*
* fill both ComboBoxes with their info
*/
PRINTSETUP32DLG_UpdateComboBox
(
hDlg
,
cmb2
,
lppi
[
PrintStructures
->
CurrentPrinter
].
pPrinterName
,
lppi
[
PrintStructures
->
CurrentPrinter
].
pPortName
);
PRINTSETUP32DLG_UpdateComboBox
(
hDlg
,
cmb3
,
lppi
[
PrintStructures
->
CurrentPrinter
].
pPrinterName
,
lppi
[
PrintStructures
->
CurrentPrinter
].
pPortName
);
/*
* set the correct radiobutton & icon for print orientation
*/
/* this should be dependent on a incoming DevMode
* (FIXME: not implemented yet) */
CheckRadioButton
(
hDlg
,
rad1
,
rad2
,
rad1
);
/* also set the correct icon (FIXME: not implemented yet) */
return
TRUE
;
}
/***********************************************************************
* PRINTDLG_CreateDevNames [internal]
*
*
* creates a DevNames structure.
* RETURNS
* HGLOBAL to DevNames memory object on success or
* zero on faillure
*/
static
HGLOBAL
PRINTDLG_CreateDevNames
(
char
*
DeviceDriverName
,
char
*
DeviceName
,
char
*
OutputPort
,
WORD
Flags
)
{
long
size
;
HGLOBAL
hDevNames
;
char
*
pDevNamesSpace
;
char
*
pTempPtr
;
LPDEVNAMES
lpDevNames
;
size
=
strlen
(
DeviceDriverName
)
+
1
+
strlen
(
DeviceName
)
+
1
+
strlen
(
OutputPort
)
+
1
+
sizeof
(
DEVNAMES
);
hDevNames
=
GlobalAlloc
(
GMEM_MOVEABLE
,
size
*
sizeof
(
char
));
if
(
hDevNames
!=
0
)
{
pDevNamesSpace
=
GlobalLock
(
hDevNames
);
lpDevNames
=
(
LPDEVNAMES
)
pDevNamesSpace
;
pTempPtr
=
pDevNamesSpace
+
sizeof
(
DEVNAMES
);
strcpy
(
pTempPtr
,
DeviceDriverName
);
lpDevNames
->
wDriverOffset
=
pTempPtr
-
pDevNamesSpace
;
pTempPtr
+=
strlen
(
DeviceDriverName
)
+
1
;
strcpy
(
pTempPtr
,
DeviceName
);
lpDevNames
->
wDeviceOffset
=
pTempPtr
-
pDevNamesSpace
;
pTempPtr
+=
strlen
(
DeviceName
)
+
1
;
strcpy
(
pTempPtr
,
OutputPort
);
lpDevNames
->
wOutputOffset
=
pTempPtr
-
pDevNamesSpace
;
lpDevNames
->
wDefault
=
Flags
;
GlobalUnlock
(
hDevNames
);
}
return
(
hDevNames
);
}
/***********************************************************************
* PRINTDLG_ValidateAndDuplicateSettings [internal]
*
*
* updates the PrintDlg structure for returnvalues.
* (yep, the name was chosen a bit stupid...)
*
* if hDlg equals zero, only hDevModes and hDevNames are adapted.
*
* RETURNS
* FALSE if user is not allowed to close (i.e. wrong nTo or nFrom values)
* TRUE if succesful.
* PRINTDLG_WMInitDialog [internal]
*/
static
BOOL
PRINTDLG_ValidateAndDuplicateSettings
(
HWND
hDlg
,
static
LRESULT
PRINTDLG_WMInitDialog
(
HWND
hDlg
,
WPARAM
wParam
,
PRINT_PTRA
*
PrintStructures
)
{
LPPRINTER_INFO_2A
lpPi
=
&
(
PrintStructures
->
lpPrinterInfo
[
PrintStructures
->
CurrentPrinter
]);
LPPRINTDLGA
lppd
=
PrintStructures
->
lpPrintDlg
;
PDEVMODEA
pDevMode
;
DEVNAMES
*
pdn
;
DEVMODEA
*
pdm
;
char
*
name
=
NULL
;
UINT
comboID
=
(
lppd
->
Flags
&
PD_PRINTSETUP
)
?
cmb1
:
cmb4
;
if
(
hDlg
!=
0
)
{
/* check whether nFromPage and nToPage are within range defined by
* nMinPage and nMaxPage
*/
if
(
IsDlgButtonChecked
(
hDlg
,
rad3
)
==
BST_CHECKED
)
{
WORD
nToPage
;
WORD
nFromPage
;
nFromPage
=
GetDlgItemInt
(
hDlg
,
edt1
,
NULL
,
FALSE
);
nToPage
=
GetDlgItemInt
(
hDlg
,
edt2
,
NULL
,
FALSE
);
if
(
nFromPage
<
lppd
->
nMinPage
||
nFromPage
>
lppd
->
nMaxPage
||
nToPage
<
lppd
->
nMinPage
||
nToPage
>
lppd
->
nMaxPage
)
{
char
resourcestr
[
256
];
char
resultstr
[
256
];
LoadStringA
(
COMDLG32_hInstance
,
PD32_INVALID_PAGE_RANGE
,
resourcestr
,
255
);
sprintf
(
resultstr
,
resourcestr
,
lppd
->
nMinPage
,
lppd
->
nMaxPage
);
LoadStringA
(
COMDLG32_hInstance
,
PD32_PRINT_TITLE
,
resourcestr
,
255
);
MessageBoxA
(
hDlg
,
resultstr
,
resourcestr
,
MB_OK
|
MB_ICONWARNING
);
return
(
FALSE
);
}
lppd
->
nFromPage
=
nFromPage
;
lppd
->
nToPage
=
nToPage
;
}
if
(
IsDlgButtonChecked
(
hDlg
,
chx1
)
==
BST_CHECKED
)
{
lppd
->
Flags
|=
PD_PRINTTOFILE
;
lpPi
->
pPortName
=
"FILE:"
;
/* load Collate ICONs */
PrintStructures
->
hCollateIcon
=
LoadIconA
(
COMDLG32_hInstance
,
"PD32_COLLATE"
);
PrintStructures
->
hNoCollateIcon
=
LoadIconA
(
COMDLG32_hInstance
,
"PD32_NOCOLLATE"
);
if
(
PrintStructures
->
hCollateIcon
==
0
||
PrintStructures
->
hNoCollateIcon
==
0
)
{
ERR
(
"no icon in resourcefile
\n
"
);
COMDLG32_SetCommDlgExtendedError
(
CDERR_LOADRESFAILURE
);
EndDialog
(
hDlg
,
FALSE
);
}
if
(
IsDlgButtonChecked
(
hDlg
,
chx2
)
==
BST_CHECKED
)
{
FIXME
(
"Collate lppd not yet implemented as output
\n
"
);
}
}
/* end-of-if(hDlg!=0) */
/* load Paper Orientation ICON */
/* FIXME: not implemented yet */
/*
* create or modify hDevMode
*/
if
(
lppd
->
hDevMode
==
0
)
{
TRACE
(
" No hDevMode yet... Need to create my own
\n
"
);
/* FIXME: possible memory leak? Memory never freed again! */
lppd
->
hDevMode
=
GlobalAlloc
(
GMEM_MOVEABLE
,
lpPi
->
pDevMode
->
dmSize
);
pDevMode
=
GlobalLock
(
lppd
->
hDevMode
);
memcpy
(
pDevMode
,
lpPi
->
pDevMode
,
lpPi
->
pDevMode
->
dmSize
);
}
else
{
FIXME
(
" already hDevMode... must adjust it... Not implemented yet
\n
"
);
pDevMode
=
GlobalLock
(
lppd
->
hDevMode
);
}
/* If hDevNames already exists, trash it.
* But create a new one anyway
*/
if
(
lppd
->
hDevNames
!=
0
)
{
if
(
(
GlobalFlags
(
lppd
->
hDevNames
)
&
0xFF
)
!=
0
)
ERR
(
" Tried to free hDevNames, but your application still has a"
" lock on hDevNames. Possible program crash..."
);
GlobalFree
(
lppd
->
hDevNames
);
}
/* FIXME: The first entry of DevNames is fixed to "winspool",
* because I don't know of any printerdriver which doesn't return
* winspool there. But I guess they do exist...
*/
lppd
->
hDevNames
=
PRINTDLG_CreateDevNames
(
"winspool"
,
lpPi
->
pDriverName
,
lpPi
->
pPortName
,
(
PrintStructures
->
DefaultPrinter
==
PrintStructures
->
CurrentPrinter
)
?
1
:
0
);
/* set PD_Collate and nCopies */
if
(
lppd
->
Flags
&
PD_USEDEVMODECOPIESANDCOLLATE
||
lppd
->
Flags
&
PD_USEDEVMODECOPIES
)
{
/* if one of the above flags was set, the application doesn't
* (want to) support multiple copies or collate...
*/
lppd
->
Flags
&=
~
PD_COLLATE
;
lppd
->
nCopies
=
1
;
/* if the printer driver supports it... store info there
* otherwise no collate & multiple copies !
*/
if
(
pDevMode
->
dmFields
&
DM_COLLATE
)
{
pDevMode
->
dmCollate
=
0
;
if
(
hDlg
!=
0
)
if
(
IsDlgButtonChecked
(
hDlg
,
chx2
)
==
BST_CHECKED
)
pDevMode
->
dmCollate
=
1
;
}
if
(
pDevMode
->
dmFields
&
DM_COPIES
)
{
pDevMode
->
dmCopies
=
1
;
if
(
hDlg
!=
0
)
pDevMode
->
dmCopies
=
GetDlgItemInt
(
hDlg
,
edt3
,
NULL
,
FALSE
);
}
}
else
{
if
(
hDlg
!=
0
)
{
/* set Collate & nCopies according to dialog */
if
(
IsDlgButtonChecked
(
hDlg
,
chx2
)
==
BST_CHECKED
)
lppd
->
Flags
|=
PD_COLLATE
;
else
lppd
->
Flags
&=
~
PD_COLLATE
;
lppd
->
nCopies
=
GetDlgItemInt
(
hDlg
,
edt3
,
NULL
,
FALSE
);
}
else
{
/* stick to defaults */
lppd
->
Flags
&=
~
PD_COLLATE
;
lppd
->
nCopies
=
1
;
}
}
/* set DC */
if
(
lppd
->
Flags
&
PD_RETURNDC
){
lppd
->
hDC
=
CreateDCA
(
NULL
,
lpPi
->
pPrinterName
,
NULL
,
NULL
);
}
GlobalUnlock
(
lppd
->
hDevMode
);
return
(
TRUE
);
}
/***********************************************************************
* PRINTSETUP32DLG_ValidateAndDuplicateSettings [internal]
*
*
* updates the PrintDlg structure for returnvalues.
* (yep, the name was chosen a bit stupid...)
*
* if hDlg equals zero, only hDevModes and hDevNames are adapted.
*
* RETURNS
* FALSE if user is not allowed to close (i.e. wrong nTo or nFrom values)
* TRUE if succesful.
*/
static
BOOL
PRINTSETUP32DLG_ValidateAndDuplicateSettings
(
HWND
hDlg
,
PRINT_PTRA
*
PrintStructures
)
{
LPPRINTDLGA
lppd
=
PrintStructures
->
lpPrintDlg
;
LPPRINTER_INFO_2A
lppi
=
&
(
PrintStructures
->
lpPrinterInfo
[
PrintStructures
->
CurrentPrinter
]);
PDEVMODEA
pDevMode
;
if
(
PRINTDLG_ValidateAndDuplicateSettings
(
0
,
PrintStructures
)
==
FALSE
)
return
(
FALSE
);
pDevMode
=
GlobalLock
(
lppd
->
hDevMode
);
/* set bin type and paper size to DevMode */
if
(
pDevMode
->
dmFields
&
DM_PAPERSIZE
)
{
pDevMode
->
u1
.
s1
.
dmPaperSize
=
PRINTSETUP32DLG_UpdateComboBox
(
hDlg
,
cmb2
,
lppi
->
pPrinterName
,
lppi
->
pPortName
);
/* FIXME: should set dmPaperLength and dmPaperWidth also??? */
}
if
(
pDevMode
->
dmFields
&
DM_DEFAULTSOURCE
)
pDevMode
->
dmDefaultSource
=
PRINTSETUP32DLG_UpdateComboBox
(
hDlg
,
cmb3
,
lppi
->
pPrinterName
,
lppi
->
pPortName
);
/* set paper orientation to DevMode */
if
(
pDevMode
->
dmFields
&
DM_ORIENTATION
)
{
if
(
IsDlgButtonChecked
(
hDlg
,
rad1
)
==
BST_CHECKED
)
pDevMode
->
u1
.
s1
.
dmOrientation
=
DMORIENT_PORTRAIT
;
else
pDevMode
->
u1
.
s1
.
dmOrientation
=
DMORIENT_LANDSCAPE
;
}
GlobalUnlock
(
lppd
->
hDevMode
);
return
(
TRUE
);
}
/***********************************************************************
* PRINTDLG_WMCommand [internal]
* if lppd->Flags PD_SHOWHELP is specified, a HELPMESGSTRING message
* must be registered and the Help button must be shown.
*/
static
LRESULT
PRINTDLG_WMCommand
(
HWND
hDlg
,
WPARAM
wParam
,
LPARAM
lParam
,
PRINT_PTRA
*
PrintStructures
)
{
LPPRINTDLGA
lppd
=
PrintStructures
->
lpPrintDlg
;
LPPRINTER_INFO_2A
lppi
=
&
(
PrintStructures
->
lpPrinterInfo
[
PrintStructures
->
CurrentPrinter
]);
switch
(
LOWORD
(
wParam
))
{
case
IDOK
:
TRACE
(
" OK button was hit
\n
"
);
if
(
PRINTDLG_ValidateAndDuplicateSettings
(
hDlg
,
PrintStructures
)
!=
TRUE
)
return
(
FALSE
);
DestroyWindow
(
hDlg
);
return
(
TRUE
);
case
IDCANCEL
:
TRACE
(
" CANCEL button was hit
\n
"
);
EndDialog
(
hDlg
,
FALSE
);
return
(
FALSE
);
case
pshHelp
:
TRACE
(
" HELP button was hit
\n
"
);
SendMessageA
(
lppd
->
hwndOwner
,
PrintStructures
->
HelpMessageID
,
(
WPARAM
)
hDlg
,
(
LPARAM
)
lppd
);
break
;
case
chx2
:
/* collate pages checkbox */
if
(
IsDlgButtonChecked
(
hDlg
,
chx2
)
==
BST_CHECKED
)
SendDlgItemMessageA
(
hDlg
,
ico3
,
STM_SETIMAGE
,
(
WPARAM
)
IMAGE_ICON
,
(
LPARAM
)
PrintStructures
->
hCollateIcon
);
else
SendDlgItemMessageA
(
hDlg
,
ico3
,
STM_SETIMAGE
,
(
WPARAM
)
IMAGE_ICON
,
(
LPARAM
)
PrintStructures
->
hNoCollateIcon
);
break
;
case
edt1
:
/* from page nr editbox */
case
edt2
:
/* to page nr editbox */
if
(
HIWORD
(
wParam
)
==
EN_CHANGE
)
{
WORD
nToPage
;
WORD
nFromPage
;
nFromPage
=
GetDlgItemInt
(
hDlg
,
edt1
,
NULL
,
FALSE
);
nToPage
=
GetDlgItemInt
(
hDlg
,
edt2
,
NULL
,
FALSE
);
if
(
nFromPage
!=
lppd
->
nFromPage
||
nToPage
!=
lppd
->
nToPage
)
CheckRadioButton
(
hDlg
,
rad1
,
rad3
,
rad3
);
}
break
;
case
psh2
:
/* Properties button */
{
/* HANDLE hPrinter;
char PrinterName[256];
GetDlgItemTextA(hDlg, cmb4, PrinterName, 255);
if (OpenPrinterA(PrinterName, &hPrinter, NULL))
{
PrinterProperties(hDlg, hPrinter);
ClosePrinter(hPrinter);
}
else
WARN(" Call to OpenPrinter did not succeed!\n");
break;
*/
MessageBoxA
(
hDlg
,
"Not implemented yet!"
,
"PRINT"
,
MB_OK
);
if
(
lppd
->
Flags
&
PD_SHOWHELP
)
{
if
((
PrintStructures
->
HelpMessageID
=
RegisterWindowMessageA
(
HELPMSGSTRING
))
==
0
)
{
COMDLG32_SetCommDlgExtendedError
(
CDERR_REGISTERMSGFAIL
);
return
FALSE
;
}
case
cmb4
:
/* Printer combobox */
if
(
HIWORD
(
wParam
)
==
CBN_SELCHANGE
)
{
int
i
;
char
PrinterName
[
256
];
}
else
PrintStructures
->
HelpMessageID
=
0
;
/* look the newly selected Printer up in
* our array Printer_Info2As
/* FIXME: I allow more freedom than either Win95 or WinNT,
* which do not agree to what errors should be thrown or not
* in case nToPage or nFromPage is out-of-range.
*/
GetDlgItemTextA
(
hDlg
,
cmb4
,
PrinterName
,
255
);
for
(
i
=
0
;
i
<
PrintStructures
->
NrOfPrinterInfoEntries
;
i
++
)
{
if
(
strcmp
(
PrintStructures
->
lpPrinterInfo
[
i
].
pPrinterName
,
PrinterName
)
==
0
)
break
;
}
PrintStructures
->
CurrentPrinter
=
i
;
PRINTDLG_UpdatePrinterInfoTexts
(
hDlg
,
PrintStructures
);
lppi
=
&
(
PrintStructures
->
lpPrinterInfo
[
PrintStructures
->
CurrentPrinter
]);
if
(
lppd
->
Flags
&
PD_USEDEVMODECOPIESANDCOLLATE
||
lppd
->
Flags
&
PD_USEDEVMODECOPIES
)
{
/* if printer doesn't support it: no nCopies */
if
(
!
(
lppi
->
pDevMode
->
dmFields
&
DM_COPIES
))
{
EnableWindow
(
GetDlgItem
(
hDlg
,
edt3
),
FALSE
);
EnableWindow
(
GetDlgItem
(
hDlg
,
stc5
),
FALSE
);
}
else
{
EnableWindow
(
GetDlgItem
(
hDlg
,
edt3
),
TRUE
);
EnableWindow
(
GetDlgItem
(
hDlg
,
stc5
),
TRUE
);
}
/* if printer doesn't support it: no Collate */
if
(
!
(
lppi
->
pDevMode
->
dmFields
&
DM_COPIES
))
{
EnableWindow
(
GetDlgItem
(
hDlg
,
ico3
),
FALSE
);
EnableWindow
(
GetDlgItem
(
hDlg
,
chx2
),
FALSE
);
}
else
{
EnableWindow
(
GetDlgItem
(
hDlg
,
ico3
),
TRUE
);
EnableWindow
(
GetDlgItem
(
hDlg
,
chx2
),
TRUE
);
}
}
if
(
lppd
->
nMaxPage
<
lppd
->
nMinPage
)
lppd
->
nMaxPage
=
lppd
->
nMinPage
;
if
(
lppd
->
nMinPage
==
lppd
->
nMaxPage
)
lppd
->
Flags
|=
PD_NOPAGENUMS
;
if
(
lppd
->
nToPage
<
lppd
->
nMinPage
)
lppd
->
nToPage
=
lppd
->
nMinPage
;
if
(
lppd
->
nToPage
>
lppd
->
nMaxPage
)
lppd
->
nToPage
=
lppd
->
nMaxPage
;
if
(
lppd
->
nFromPage
<
lppd
->
nMinPage
)
lppd
->
nFromPage
=
lppd
->
nMinPage
;
if
(
lppd
->
nFromPage
>
lppd
->
nMaxPage
)
lppd
->
nFromPage
=
lppd
->
nMaxPage
;
}
break
;
}
return
FALSE
;
}
/* Fill Combobox
*/
pdn
=
GlobalLock
(
lppd
->
hDevNames
);
pdm
=
GlobalLock
(
lppd
->
hDevMode
);
if
(
pdn
)
name
=
(
char
*
)
pdn
+
pdn
->
wDeviceOffset
;
else
if
(
pdm
)
name
=
pdm
->
dmDeviceName
;
PRINTDLG_SetUpPrinterListCombo
(
hDlg
,
comboID
,
name
);
if
(
pdm
)
GlobalUnlock
(
lppd
->
hDevMode
);
if
(
pdn
)
GlobalUnlock
(
lppd
->
hDevNames
);
/* Now find selected printer and update rest of dlg */
name
=
HeapAlloc
(
GetProcessHeap
(),
0
,
256
);
GetDlgItemTextA
(
hDlg
,
comboID
,
name
,
255
);
PRINTDLG_ChangePrinter
(
hDlg
,
name
,
PrintStructures
);
HeapFree
(
GetProcessHeap
(),
0
,
name
);
return
TRUE
;
}
/***********************************************************************
*
PRINTSETUP32
DLG_WMCommand [internal]
*
PRINT
DLG_WMCommand [internal]
*/
static
LRESULT
PRINT
SETUP32
DLG_WMCommand
(
HWND
hDlg
,
WPARAM
wParam
,
static
LRESULT
PRINTDLG_WMCommand
(
HWND
hDlg
,
WPARAM
wParam
,
LPARAM
lParam
,
PRINT_PTRA
*
PrintStructures
)
{
LPPRINTDLGA
lppd
=
PrintStructures
->
lpPrintDlg
;
LPPRINTER_INFO_2A
lppi
=
&
(
PrintStructures
->
lpPrinterInfo
[
PrintStructures
->
CurrentPrinter
])
;
UINT
PrinterComboID
=
(
lppd
->
Flags
&
PD_PRINTSETUP
)
?
cmb1
:
cmb4
;
LPDEVMODEA
lpdm
=
PrintStructures
->
lpDevMode
;
switch
(
LOWORD
(
wParam
))
{
switch
(
LOWORD
(
wParam
))
{
case
IDOK
:
TRACE
(
" OK button was hit
\n
"
);
if
(
PRINT
SETUP32DLG_ValidateAndDuplicateSettings
(
hDlg
,
PrintStructures
)
!=
TRUE
)
if
(
PRINT
DLG_UpdatePrintDlg
(
hDlg
,
PrintStructures
)
!=
TRUE
)
return
(
FALSE
);
DestroyWindow
(
hDlg
);
EndDialog
(
hDlg
,
TRUE
);
return
(
TRUE
);
case
IDCANCEL
:
TRACE
(
" CANCEL button was hit
\n
"
);
EndDialog
(
hDlg
,
FALSE
);
return
(
FALSE
);
case
pshHelp
:
TRACE
(
" HELP button was hit
\n
"
);
SendMessageA
(
lppd
->
hwndOwner
,
PrintStructures
->
HelpMessageID
,
(
WPARAM
)
hDlg
,
(
LPARAM
)
lppd
);
break
;
case
psh2
:
/* Properties button */
MessageBoxA
(
hDlg
,
"Not implemented yet!"
,
"PRINT SETUP"
,
MB_OK
);
case
chx2
:
/* collate pages checkbox */
if
(
IsDlgButtonChecked
(
hDlg
,
chx2
)
==
BST_CHECKED
)
SendDlgItemMessageA
(
hDlg
,
ico3
,
STM_SETIMAGE
,
(
WPARAM
)
IMAGE_ICON
,
(
LPARAM
)
PrintStructures
->
hCollateIcon
);
else
SendDlgItemMessageA
(
hDlg
,
ico3
,
STM_SETIMAGE
,
(
WPARAM
)
IMAGE_ICON
,
(
LPARAM
)
PrintStructures
->
hNoCollateIcon
);
break
;
case
edt1
:
/* from page nr editbox */
case
edt2
:
/* to page nr editbox */
if
(
HIWORD
(
wParam
)
==
EN_CHANGE
)
{
WORD
nToPage
;
WORD
nFromPage
;
nFromPage
=
GetDlgItemInt
(
hDlg
,
edt1
,
NULL
,
FALSE
);
nToPage
=
GetDlgItemInt
(
hDlg
,
edt2
,
NULL
,
FALSE
);
if
(
nFromPage
!=
lppd
->
nFromPage
||
nToPage
!=
lppd
->
nToPage
)
CheckRadioButton
(
hDlg
,
rad1
,
rad3
,
rad3
);
}
break
;
case
cmb1
:
/* Printer combobox */
if
(
HIWORD
(
wParam
)
==
CBN_SELCHANGE
)
case
psh2
:
/* Properties button */
{
int
i
;
char
Name
[
256
];
HANDLE
hPrinter
;
char
Printer
Name
[
256
];
/* look the newly selected Printer up in
* our array Printer_Info2As
*/
GetDlgItemTextA
(
hDlg
,
cmb1
,
Name
,
255
);
for
(
i
=
0
;
i
<
PrintStructures
->
NrOfPrinterInfoEntries
;
i
++
)
{
if
(
strcmp
(
PrintStructures
->
lpPrinterInfo
[
i
].
pPrinterName
,
Name
)
==
0
)
GetDlgItemTextA
(
hDlg
,
PrinterComboID
,
PrinterName
,
255
);
if
(
!
OpenPrinterA
(
PrinterName
,
&
hPrinter
,
NULL
))
{
WARN
(
" Call to OpenPrinter did not succeed!
\n
"
);
break
;
}
DocumentPropertiesA
(
hDlg
,
hPrinter
,
PrinterName
,
PrintStructures
->
lpDevMode
,
PrintStructures
->
lpDevMode
,
DM_IN_BUFFER
|
DM_OUT_BUFFER
|
DM_IN_PROMPT
);
ClosePrinter
(
hPrinter
);
break
;
}
PrintStructures
->
CurrentPrinter
=
i
;
PRINTDLG_UpdatePrinterInfoTexts
(
hDlg
,
PrintStructures
);
lppi
=
&
(
PrintStructures
->
lpPrinterInfo
[
PrintStructures
->
CurrentPrinter
]);
/* Update both ComboBoxes to the items available for the new
* printer. Keep the same entry selected, if possible
*/
PRINTSETUP32DLG_UpdateComboBox
(
hDlg
,
cmb2
,
lppi
->
pPrinterName
,
lppi
->
pPortName
);
PRINTSETUP32DLG_UpdateComboBox
(
hDlg
,
cmb3
,
lppi
->
pPrinterName
,
lppi
->
pPortName
);
case
cmb1
:
case
cmb4
:
/* Printer combobox */
if
(
HIWORD
(
wParam
)
==
CBN_SELCHANGE
)
{
char
PrinterName
[
256
];
GetDlgItemTextA
(
hDlg
,
LOWORD
(
wParam
),
PrinterName
,
255
);
PRINTDLG_ChangePrinter
(
hDlg
,
PrinterName
,
PrintStructures
);
}
break
;
case
cmb2
:
/* Papersize */
{
DWORD
Sel
=
SendDlgItemMessageA
(
hDlg
,
cmb2
,
CB_GETCURSEL
,
0
,
0
);
if
(
Sel
!=
CB_ERR
)
lpdm
->
u1
.
s1
.
dmPaperSize
=
SendDlgItemMessageA
(
hDlg
,
cmb2
,
CB_GETITEMDATA
,
Sel
,
0
);
}
break
;
case
cmb3
:
/* Bin */
{
DWORD
Sel
=
SendDlgItemMessageA
(
hDlg
,
cmb3
,
CB_GETCURSEL
,
0
,
0
);
if
(
Sel
!=
CB_ERR
)
lpdm
->
dmDefaultSource
=
SendDlgItemMessageA
(
hDlg
,
cmb3
,
CB_GETITEMDATA
,
Sel
,
0
);
}
break
;
}
return
FALSE
;
}
/***********************************************************************
* PrintDlgProcA [internal]
*/
LRESULT
WINAPI
PrintDlgProcA
(
HWND
hDlg
,
UINT
uMsg
,
WPARAM
wParam
,
BOOL
WINAPI
PrintDlgProcA
(
HWND
hDlg
,
UINT
uMsg
,
WPARAM
wParam
,
LPARAM
lParam
)
{
PRINT_PTRA
*
PrintStructures
;
LRESULT
res
=
FALSE
;
if
(
uMsg
!=
WM_INITDIALOG
)
{
if
(
uMsg
!=
WM_INITDIALOG
)
{
PrintStructures
=
(
PRINT_PTRA
*
)
GetWindowLongA
(
hDlg
,
DWL_USER
);
if
(
!
PrintStructures
)
return
FALSE
;
}
else
{
PrintStructures
=
(
PRINT_PTRA
*
)
lParam
;
if
(
!
PRINTDLG_WMInitDialog
(
hDlg
,
wParam
,
lParam
,
PrintStructures
))
{
TRACE
(
"PRINTDLG_WMInitDialog returned FALSE
\n
"
);
return
FALSE
;
}
else
{
PrintStructures
=
(
PRINT_PTRA
*
)
lParam
;
SetWindowLongA
(
hDlg
,
DWL_USER
,
lParam
);
res
=
PRINTDLG_WMInitDialog
(
hDlg
,
wParam
,
PrintStructures
);
if
(
PrintStructures
->
lpPrintDlg
->
Flags
&
PD_ENABLEPRINTHOOK
)
{
res
=
PrintStructures
->
lpPrintDlg
->
lpfnPrintHook
(
hDlg
,
uMsg
,
wParam
,
(
LPARAM
)
PrintStructures
->
lpPrintDlg
);
}
return
res
;
}
switch
(
uMsg
)
{
if
(
PrintStructures
->
lpPrintDlg
->
Flags
&
PD_ENABLEPRINTHOOK
)
{
res
=
PrintStructures
->
lpPrintDlg
->
lpfnPrintHook
(
hDlg
,
uMsg
,
wParam
,
lParam
);
if
(
res
)
return
res
;
}
switch
(
uMsg
)
{
case
WM_COMMAND
:
return
PRINTDLG_WMCommand
(
hDlg
,
wParam
,
lParam
,
PrintStructures
);
case
WM_DESTROY
:
DestroyIcon
(
PrintStructures
->
hCollateIcon
);
DestroyIcon
(
PrintStructures
->
hNoCollateIcon
);
/* FIXME: don't forget to delete the paper orientation icons here! */
return
FALSE
;
}
return
res
;
}
/************************************************************
*
* PRINTDLG_GetDlgTemplate
*
*/
static
HGLOBAL
PRINTDLG_GetDlgTemplate
(
PRINTDLGA
*
lppd
)
{
HGLOBAL
hDlgTmpl
,
hResInfo
;
if
(
lppd
->
Flags
&
PD_PRINTSETUP
)
{
if
(
lppd
->
Flags
&
PD_ENABLESETUPTEMPLATEHANDLE
)
{
hDlgTmpl
=
lppd
->
hSetupTemplate
;
}
else
if
(
lppd
->
Flags
&
PD_ENABLESETUPTEMPLATE
)
{
hResInfo
=
FindResourceA
(
lppd
->
hInstance
,
lppd
->
lpSetupTemplateName
,
RT_DIALOGA
);
hDlgTmpl
=
LoadResource
(
lppd
->
hInstance
,
hResInfo
);
}
else
{
hResInfo
=
FindResourceA
(
COMDLG32_hInstance
,
"PRINT32_SETUP"
,
RT_DIALOGA
);
hDlgTmpl
=
LoadResource
(
COMDLG32_hInstance
,
hResInfo
);
}
}
else
{
if
(
lppd
->
Flags
&
PD_ENABLEPRINTTEMPLATEHANDLE
)
{
hDlgTmpl
=
lppd
->
hPrintTemplate
;
}
else
if
(
lppd
->
Flags
&
PD_ENABLEPRINTTEMPLATE
)
{
hResInfo
=
FindResourceA
(
lppd
->
hInstance
,
lppd
->
lpPrintTemplateName
,
RT_DIALOGA
);
hDlgTmpl
=
LoadResource
(
lppd
->
hInstance
,
hResInfo
);
}
else
{
hResInfo
=
FindResourceA
(
COMDLG32_hInstance
,
"PRINT32"
,
RT_DIALOGA
);
hDlgTmpl
=
LoadResource
(
COMDLG32_hInstance
,
hResInfo
);
}
}
return
hDlgTmpl
;
}
/***********************************************************************
*
* PRINTDLG_CreateDC
*
*/
static
BOOL
PRINTDLG_CreateDC
(
LPPRINTDLGA
lppd
)
{
DEVNAMES
*
pdn
=
GlobalLock
(
lppd
->
hDevNames
);
DEVMODEA
*
pdm
=
GlobalLock
(
lppd
->
hDevMode
);
if
(
lppd
->
Flags
&
PD_RETURNDC
)
{
lppd
->
hDC
=
CreateDCA
((
char
*
)
pdn
+
pdn
->
wDriverOffset
,
(
char
*
)
pdn
+
pdn
->
wDeviceOffset
,
(
char
*
)
pdn
+
pdn
->
wOutputOffset
,
pdm
);
}
else
if
(
lppd
->
Flags
&
PD_RETURNIC
)
{
lppd
->
hDC
=
CreateICA
((
char
*
)
pdn
+
pdn
->
wDriverOffset
,
(
char
*
)
pdn
+
pdn
->
wDeviceOffset
,
(
char
*
)
pdn
+
pdn
->
wOutputOffset
,
pdm
);
}
GlobalUnlock
(
lppd
->
hDevNames
);
GlobalUnlock
(
lppd
->
hDevMode
);
return
lppd
->
hDC
?
TRUE
:
FALSE
;
}
/***********************************************************************
* PrintDlgA (COMDLG32.17)
*
* Displays the the PRINT dialog box, which enables the user to specify
* specific properties of the print job.
*
* RETURNS
* nonzero if the user pressed the OK button
* zero if the user cancelled the window or an error occurred
*
* BUGS
* PrintDlg:
* * The Collate Icons do not display, even though they are in the code.
* * The Properties Button(s) should call DocumentPropertiesA().
* PrintSetupDlg:
* * The Paper Orientation Icons are not implemented yet.
* * The Properties Button(s) should call DocumentPropertiesA().
* * Settings are not yet taken from a provided DevMode or
* default printer settings.
*/
BOOL
WINAPI
PrintDlgA
(
LPPRINTDLGA
lppd
/* ptr to PRINTDLG32 struct */
)
{
BOOL
bRet
=
FALSE
;
LPVOID
ptr
;
HINSTANCE
hInst
=
GetWindowLongA
(
lppd
->
hwndOwner
,
GWL_HINSTANCE
);
if
(
TRACE_ON
(
commdlg
))
{
char
flagstr
[
1000
]
=
""
;
struct
pd_flags
*
pflag
=
pd_flags
;
for
(
;
pflag
->
name
;
pflag
++
)
{
if
(
lppd
->
Flags
&
pflag
->
flag
)
strcat
(
flagstr
,
pflag
->
name
);
}
TRACE
(
"(%p): hwndOwner = %08x, hDevMode = %08x, hDevNames = %08x
\n
"
"pp. %d-%d, min p %d, max p %d, copies %d, hinst %08x
\n
"
"flags %08lx (%s)
\n
"
,
lppd
,
lppd
->
hwndOwner
,
lppd
->
hDevMode
,
lppd
->
hDevNames
,
lppd
->
nFromPage
,
lppd
->
nToPage
,
lppd
->
nMinPage
,
lppd
->
nMaxPage
,
lppd
->
nCopies
,
lppd
->
hInstance
,
lppd
->
Flags
,
flagstr
);
}
if
(
lppd
->
lStructSize
!=
sizeof
(
PRINTDLGA
))
{
WARN
(
"structure size failure !!!
\n
"
);
COMDLG32_SetCommDlgExtendedError
(
CDERR_STRUCTSIZE
);
return
FALSE
;
}
if
(
lppd
->
Flags
&
PD_RETURNDEFAULT
)
{
PRINTER_INFO_2A
*
pbuf
;
HANDLE
hprn
;
DWORD
needed
;
if
(
lppd
->
hDevMode
||
lppd
->
hDevNames
)
{
WARN
(
"hDevMode or hDevNames non-zero for PD_RETURNDEFAULT
\n
"
);
COMDLG32_SetCommDlgExtendedError
(
PDERR_RETDEFFAILURE
);
return
FALSE
;
}
if
(
!
PRINTDLG_OpenDefaultPrinter
(
&
hprn
))
{
WARN
(
"Can't find default printer
\n
"
);
COMDLG32_SetCommDlgExtendedError
(
PDERR_NODEFAULTPRN
);
return
FALSE
;
}
GetPrinterA
(
hprn
,
2
,
NULL
,
0
,
&
needed
);
pbuf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
needed
);
GetPrinterA
(
hprn
,
2
,
(
LPBYTE
)
pbuf
,
needed
,
&
needed
);
ClosePrinter
(
hprn
);
PRINTDLG_CreateDevNames
(
&
(
lppd
->
hDevNames
),
"winspool"
,
pbuf
->
pDevMode
->
dmDeviceName
,
pbuf
->
pPortName
);
lppd
->
hDevMode
=
GlobalAlloc
(
GMEM_MOVEABLE
,
pbuf
->
pDevMode
->
dmSize
+
pbuf
->
pDevMode
->
dmDriverExtra
);
ptr
=
GlobalLock
(
lppd
->
hDevMode
);
memcpy
(
ptr
,
pbuf
->
pDevMode
,
pbuf
->
pDevMode
->
dmSize
+
pbuf
->
pDevMode
->
dmDriverExtra
);
GlobalUnlock
(
lppd
->
hDevMode
);
HeapFree
(
GetProcessHeap
(),
0
,
pbuf
);
bRet
=
TRUE
;
}
else
{
HGLOBAL
hDlgTmpl
;
PRINT_PTRA
*
PrintStructures
;
/* load Dialog resources,
* depending on Flags indicates Print32 or Print32_setup dialog
*/
hDlgTmpl
=
PRINTDLG_GetDlgTemplate
(
lppd
);
if
(
!
(
hDlgTmpl
)
||
!
(
ptr
=
LockResource
(
hDlgTmpl
)))
{
COMDLG32_SetCommDlgExtendedError
(
CDERR_LOADRESFAILURE
);
return
FALSE
;
}
PrintStructures
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
PRINT_PTRA
));
PrintStructures
->
lpPrintDlg
=
lppd
;
/* and create & process the dialog
*/
bRet
=
DialogBoxIndirectParamA
(
hInst
,
ptr
,
lppd
->
hwndOwner
,
PrintDlgProcA
,
(
LPARAM
)
PrintStructures
);
if
(
bRet
)
{
DEVMODEA
*
lpdm
=
PrintStructures
->
lpDevMode
,
*
lpdmReturn
;
PRINTER_INFO_2A
*
pi
=
PrintStructures
->
lpPrinterInfo
;
if
(
lppd
->
hDevMode
==
0
)
{
TRACE
(
" No hDevMode yet... Need to create my own
\n
"
);
lppd
->
hDevMode
=
GlobalAlloc
(
GMEM_MOVEABLE
,
lpdm
->
dmSize
+
lpdm
->
dmDriverExtra
);
}
else
{
WORD
locks
;
if
((
locks
=
(
GlobalFlags
(
lppd
->
hDevMode
)
&
GMEM_LOCKCOUNT
)))
{
WARN
(
"hDevMode has %d locks on it. Unlocking it now
\n
"
,
locks
);
while
(
locks
--
)
{
GlobalUnlock
(
lppd
->
hDevMode
);
TRACE
(
"Now got %d locks
\n
"
,
locks
);
}
}
lppd
->
hDevMode
=
GlobalReAlloc
(
lppd
->
hDevMode
,
lpdm
->
dmSize
+
lpdm
->
dmDriverExtra
,
GMEM_MOVEABLE
);
}
lpdmReturn
=
GlobalLock
(
lppd
->
hDevMode
);
memcpy
(
lpdmReturn
,
lpdm
,
lpdm
->
dmSize
+
lpdm
->
dmDriverExtra
);
if
(
lppd
->
hDevNames
!=
0
)
{
WORD
locks
;
if
((
locks
=
(
GlobalFlags
(
lppd
->
hDevNames
)
&
GMEM_LOCKCOUNT
)))
{
WARN
(
"hDevNames has %d locks on it. Unlocking it now
\n
"
,
locks
);
while
(
locks
--
)
GlobalUnlock
(
lppd
->
hDevNames
);
}
}
PRINTDLG_CreateDevNames
(
&
(
lppd
->
hDevNames
),
"winspool"
,
lpdmReturn
->
dmDeviceName
,
pi
->
pPortName
);
GlobalUnlock
(
lppd
->
hDevMode
);
}
HeapFree
(
GetProcessHeap
(),
0
,
PrintStructures
->
lpDevMode
);
HeapFree
(
GetProcessHeap
(),
0
,
PrintStructures
->
lpPrinterInfo
);
HeapFree
(
GetProcessHeap
(),
0
,
PrintStructures
);
}
if
(
bRet
&&
(
lppd
->
Flags
&
PD_RETURNDC
||
lppd
->
Flags
&
PD_RETURNIC
))
bRet
=
PRINTDLG_CreateDC
(
lppd
);
TRACE
(
"exit! (%d)
\n
"
,
bRet
);
return
bRet
;
}
/***********************************************************************
* PrintDlgW (COMDLG32.18)
*/
BOOL
WINAPI
PrintDlgW
(
LPPRINTDLGW
printdlg
)
{
FIXME
(
"A really empty stub
\n
"
);
return
FALSE
;
}
/***********************************************************************
*
* PageSetupDlg
*/
/***********************************************************************
* PageSetupDlgA (COMDLG32.15)
*/
BOOL
WINAPI
PageSetupDlgA
(
LPPAGESETUPDLGA
setupdlg
)
{
FIXME
(
"(%p), stub!
\n
"
,
setupdlg
);
return
FALSE
;
}
/***********************************************************************
* PageSetupDlgW (COMDLG32.16)
*/
BOOL
WINAPI
PageSetupDlgW
(
LPPAGESETUPDLGW
setupdlg
)
{
FIXME
(
"(%p), stub!
\n
"
,
setupdlg
);
return
FALSE
;
}
/**********************************************************************
*
* 16 bit commdlg
*/
/***********************************************************************
* PrintDlgProc16 (COMMDLG.21)
...
...
@@ -1207,7 +1073,7 @@ LRESULT WINAPI PrintDlgProc16(HWND16 hWnd, UINT16 wMsg, WPARAM16 wParam,
/***********************************************************************
* PrintSetupDlgProc (COMMDLG.22)
* PrintSetupDlgProc
16
(COMMDLG.22)
*/
LRESULT
WINAPI
PrintSetupDlgProc16
(
HWND16
hWnd
,
UINT16
wMsg
,
WPARAM16
wParam
,
LPARAM
lParam
)
...
...
@@ -1234,54 +1100,98 @@ LRESULT WINAPI PrintSetupDlgProc16(HWND16 hWnd, UINT16 wMsg, WPARAM16 wParam,
/***********************************************************************
* PrintSetupDlgProcA [???]
* PrintDlg16 (COMMDLG.20)
*
* Displays the the PRINT dialog box, which enables the user to specify
* specific properties of the print job.
*
* RETURNS
* nonzero if the user pressed the OK button
* zero if the user cancelled the window or an error occurred
*
* FIXME:
* note: I don't know whether this function actually is allowed
* to exist (i.e. is exported/overrideable from the DLL)
* For now, this function is local only.
* If necessary, this call can be merged with PrintDlgProcA,
* as it is very similar.
* BUGS
* * calls up to the 32-bit versions of the Dialogs, which look different
* * Customizing is *not* implemented.
*/
LRESULT
WINAPI
PrintSetupDlgProcA
(
HWND
hDlg
,
UINT
uMsg
,
WPARAM
wParam
,
LPARAM
lParam
)
BOOL16
WINAPI
PrintDlg16
(
LPPRINTDLG16
lpPrint
)
{
PRINT_PTRA
*
PrintStructures
;
LRESULT
res
=
FALSE
;
if
(
uMsg
!=
WM_INITDIALOG
)
{
PrintStructures
=
(
PRINT_PTRA
*
)
GetWindowLongA
(
hDlg
,
DWL_USER
);
if
(
!
PrintStructures
)
return
FALSE
;
}
else
{
PrintStructures
=
(
PRINT_PTRA
*
)
lParam
;
if
(
!
PRINTSETUP32DLG_WMInitDialog
(
hDlg
,
wParam
,
lParam
,
PrintStructures
))
{
TRACE
(
"PRINTSETUP32DLG_WMInitDialog returned FALSE
\n
"
);
return
FALSE
;
}
PRINTDLGA
Print32
;
BOOL16
ret
;
char
*
ptr
,
*
ptr16
;
DWORD
size
;
memset
(
&
Print32
,
0
,
sizeof
(
Print32
));
Print32
.
lStructSize
=
sizeof
(
Print32
);
Print32
.
hwndOwner
=
lpPrint
->
hwndOwner
;
if
(
lpPrint
->
hDevMode
)
{
size
=
GlobalSize16
(
lpPrint
->
hDevMode
);
Print32
.
hDevMode
=
GlobalAlloc
(
GMEM_MOVEABLE
,
size
);
ptr
=
GlobalLock
(
Print32
.
hDevMode
);
ptr16
=
GlobalLock16
(
lpPrint
->
hDevMode
);
memcpy
(
ptr
,
ptr16
,
size
);
GlobalFree16
(
lpPrint
->
hDevMode
);
GlobalUnlock
(
Print32
.
hDevMode
);
}
else
Print32
.
hDevMode
=
0
;
if
(
lpPrint
->
hDevNames
)
{
size
=
GlobalSize16
(
lpPrint
->
hDevNames
);
Print32
.
hDevNames
=
GlobalAlloc
(
GMEM_MOVEABLE
,
size
);
ptr
=
GlobalLock
(
Print32
.
hDevNames
);
ptr16
=
GlobalLock16
(
lpPrint
->
hDevNames
);
memcpy
(
ptr
,
ptr16
,
size
);
GlobalFree16
(
lpPrint
->
hDevNames
);
GlobalUnlock
(
Print32
.
hDevNames
);
}
else
Print32
.
hDevNames
=
0
;
Print32
.
Flags
=
lpPrint
->
Flags
;
Print32
.
nFromPage
=
lpPrint
->
nFromPage
;
Print32
.
nToPage
=
lpPrint
->
nToPage
;
Print32
.
nMinPage
=
lpPrint
->
nMinPage
;
Print32
.
nMaxPage
=
lpPrint
->
nMaxPage
;
Print32
.
nCopies
=
lpPrint
->
nCopies
;
Print32
.
hInstance
=
lpPrint
->
hInstance
;
Print32
.
lCustData
=
lpPrint
->
lCustData
;
if
(
lpPrint
->
lpfnPrintHook
)
{
FIXME
(
"Need to allocate thunk
\n
"
);
/* Print32.lpfnPrintHook = lpPrint->lpfnPrintHook;*/
}
switch
(
uMsg
)
{
case
WM_COMMAND
:
return
PRINTSETUP32DLG_WMCommand
(
hDlg
,
wParam
,
lParam
,
PrintStructures
);
case
WM_DESTROY
:
return
FALSE
;
if
(
lpPrint
->
lpfnSetupHook
)
{
FIXME
(
"Need to allocate thunk
\n
"
);
/* Print32.lpfnSetupHook = lpPrint->lpfnSetupHook;*/
}
Print32
.
lpPrintTemplateName
=
PTR_SEG_TO_LIN
(
lpPrint
->
lpPrintTemplateName
);
Print32
.
lpSetupTemplateName
=
PTR_SEG_TO_LIN
(
lpPrint
->
lpSetupTemplateName
);
Print32
.
hPrintTemplate
=
lpPrint
->
hPrintTemplate
;
Print32
.
hSetupTemplate
=
lpPrint
->
hSetupTemplate
;
return
res
;
}
ret
=
PrintDlgA
(
&
Print32
);
if
(
Print32
.
hDevMode
)
{
size
=
GlobalSize
(
Print32
.
hDevMode
);
lpPrint
->
hDevMode
=
GlobalAlloc16
(
GMEM_MOVEABLE
,
size
);
ptr16
=
GlobalLock16
(
lpPrint
->
hDevMode
);
ptr
=
GlobalLock
(
Print32
.
hDevMode
);
memcpy
(
ptr16
,
ptr
,
size
);
GlobalFree
(
Print32
.
hDevMode
);
GlobalUnlock16
(
lpPrint
->
hDevMode
);
}
else
lpPrint
->
hDevMode
=
0
;
if
(
Print32
.
hDevNames
)
{
size
=
GlobalSize
(
Print32
.
hDevNames
);
lpPrint
->
hDevNames
=
GlobalAlloc16
(
GMEM_MOVEABLE
,
size
);
ptr16
=
GlobalLock16
(
lpPrint
->
hDevNames
);
ptr
=
GlobalLock
(
Print32
.
hDevNames
);
memcpy
(
ptr16
,
ptr
,
size
);
GlobalFree
(
Print32
.
hDevNames
);
GlobalUnlock16
(
lpPrint
->
hDevNames
);
}
else
lpPrint
->
hDevNames
=
0
;
lpPrint
->
hDC
=
Print32
.
hDC
;
lpPrint
->
Flags
=
Print32
.
Flags
;
lpPrint
->
nFromPage
=
Print32
.
nFromPage
;
lpPrint
->
nToPage
=
Print32
.
nToPage
;
lpPrint
->
nCopies
=
Print32
.
nCopies
;
/***********************************************************************
* PageSetupDlgA (COMDLG32.15)
*/
BOOL
WINAPI
PageSetupDlgA
(
LPPAGESETUPDLGA
setupdlg
)
{
FIXME
(
"(%p), stub!
\n
"
,
setupdlg
);
return
FALSE
;
return
ret
;
}
include/commdlg.h
View file @
b40a9b7f
...
...
@@ -48,34 +48,10 @@ extern "C" {
#define SAVE_DIALOG 1
#define OPEN_DIALOG 2
typedef
UINT16
(
CALLBACK
*
LPOFNHOOKPROC16
)(
HWND16
,
UINT16
,
WPARAM16
,
LPARAM
);
typedef
UINT
(
CALLBACK
*
LPOFNHOOKPROC
)(
HWND
,
UINT
,
WPARAM
,
LPARAM
);
typedef
struct
{
DWORD
lStructSize
;
HWND16
hwndOwner
;
HINSTANCE16
hInstance
;
SEGPTR
lpstrFilter
;
SEGPTR
lpstrCustomFilter
;
DWORD
nMaxCustFilter
;
DWORD
nFilterIndex
;
SEGPTR
lpstrFile
;
DWORD
nMaxFile
;
SEGPTR
lpstrFileTitle
;
DWORD
nMaxFileTitle
;
SEGPTR
lpstrInitialDir
;
SEGPTR
lpstrTitle
;
DWORD
Flags
;
UINT16
nFileOffset
;
UINT16
nFileExtension
;
SEGPTR
lpstrDefExt
;
LPARAM
lCustData
;
LPOFNHOOKPROC16
lpfnHook
;
SEGPTR
lpTemplateName
;
}
OPENFILENAME16
,
*
LPOPENFILENAME16
;
typedef
struct
{
DWORD
lStructSize
;
HWND
hwndOwner
;
HINSTANCE
hInstance
;
LPCSTR
lpstrFilter
;
...
...
@@ -140,24 +116,10 @@ typedef struct
DECL_WINELIB_TYPE_AW
(
OFNOTIFY
)
DECL_WINELIB_TYPE_AW
(
LPOFNOTIFY
)
typedef
UINT16
(
CALLBACK
*
LPCCHOOKPROC16
)
(
HWND16
,
UINT16
,
WPARAM16
,
LPARAM
);
typedef
UINT
(
CALLBACK
*
LPCCHOOKPROC
)
(
HWND
,
UINT
,
WPARAM
,
LPARAM
);
typedef
struct
{
DWORD
lStructSize
;
HWND16
hwndOwner
;
HWND16
hInstance
;
COLORREF
rgbResult
;
COLORREF
*
lpCustColors
;
DWORD
Flags
;
LPARAM
lCustData
;
LPCCHOOKPROC16
lpfnHook
;
SEGPTR
lpTemplateName
;
}
CHOOSECOLOR16
;
typedef
CHOOSECOLOR16
*
LPCHOOSECOLOR16
;
typedef
struct
{
DWORD
lStructSize
;
HWND
hwndOwner
;
HWND
hInstance
;
DWORD
rgbResult
;
...
...
@@ -194,29 +156,12 @@ DECL_WINELIB_TYPE_AW(LPCHOOSECOLOR)
#define CC_ENABLETEMPLATE 0x00000020
#define CC_ENABLETEMPLATEHANDLE 0x00000040
typedef
UINT16
(
CALLBACK
*
LPFRHOOKPROC16
)(
HWND16
,
UINT16
,
WPARAM16
,
LPARAM
);
typedef
UINT
(
CALLBACK
*
LPFRHOOKPROC
)(
HWND
,
UINT
,
WPARAM
,
LPARAM
);
typedef
struct
{
DWORD
lStructSize
;
/* size of this struct 0x20 */
HWND16
hwndOwner
;
/* handle to owner's window */
HINSTANCE16
hInstance
;
/* instance handle of.EXE that */
/* contains cust. dlg. template */
DWORD
Flags
;
/* one or more of the FR_?? */
SEGPTR
lpstrFindWhat
;
/* ptr. to search string */
SEGPTR
lpstrReplaceWith
;
/* ptr. to replace string */
UINT16
wFindWhatLen
;
/* size of find buffer */
UINT16
wReplaceWithLen
;
/* size of replace buffer */
LPARAM
lCustData
;
/* data passed to hook fn. */
LPFRHOOKPROC16
lpfnHook
;
SEGPTR
lpTemplateName
;
/* custom template name */
}
FINDREPLACE16
,
*
LPFINDREPLACE16
;
typedef
struct
{
DWORD
lStructSize
;
HWND
hwndOwner
;
HINSTANCE
hInstance
;
DWORD
Flags
;
LPSTR
lpstrFindWhat
;
LPSTR
lpstrReplaceWith
;
...
...
@@ -225,13 +170,12 @@ typedef struct {
LPARAM
lCustData
;
LPFRHOOKPROC
lpfnHook
;
LPCSTR
lpTemplateName
;
}
FINDREPLACEA
,
*
LPFINDREPLACEA
;
}
FINDREPLACEA
,
*
LPFINDREPLACEA
;
typedef
struct
{
DWORD
lStructSize
;
HWND
hwndOwner
;
HINSTANCE
hInstance
;
DWORD
Flags
;
LPWSTR
lpstrFindWhat
;
LPWSTR
lpstrReplaceWith
;
...
...
@@ -240,7 +184,7 @@ typedef struct {
LPARAM
lCustData
;
LPFRHOOKPROC
lpfnHook
;
LPCWSTR
lpTemplateName
;
}
FINDREPLACEW
,
*
LPFINDREPLACEW
;
}
FINDREPLACEW
,
*
LPFINDREPLACEW
;
DECL_WINELIB_TYPE_AW
(
FINDREPLACE
)
DECL_WINELIB_TYPE_AW
(
LPFINDREPLACE
)
...
...
@@ -263,36 +207,10 @@ DECL_WINELIB_TYPE_AW(LPFINDREPLACE)
#define FR_HIDEMATCHCASE 0x00008000
#define FR_HIDEWHOLEWORD 0x00010000
typedef
UINT16
(
CALLBACK
*
LPCFHOOKPROC16
)(
HWND16
,
UINT16
,
WPARAM16
,
LPARAM
);
typedef
UINT
(
CALLBACK
*
LPCFHOOKPROC
)(
HWND
,
UINT
,
WPARAM
,
LPARAM
);
typedef
struct
{
DWORD
lStructSize
;
HWND16
hwndOwner
;
/* caller's window handle */
HDC16
hDC
;
/* printer DC/IC or NULL */
SEGPTR
lpLogFont
;
/* ptr. to a LOGFONT struct */
short
iPointSize
;
/* 10 * size in points of selected font */
DWORD
Flags
;
/* enum. type flags */
COLORREF
rgbColors
;
/* returned text color */
LPARAM
lCustData
;
/* data passed to hook fn. */
LPCFHOOKPROC16
lpfnHook
;
SEGPTR
lpTemplateName
;
/* custom template name */
HINSTANCE16
hInstance
;
/* instance handle of.EXE that */
/* contains cust. dlg. template */
SEGPTR
lpszStyle
;
/* return the style field here */
/* must be LF_FACESIZE or bigger */
UINT16
nFontType
;
/* same value reported to the */
/* EnumFonts callback with the */
/* extra FONTTYPE_ bits added */
short
nSizeMin
;
/* minimum pt size allowed & */
short
nSizeMax
;
/* max pt size allowed if */
/* CF_LIMITSIZE is used */
}
CHOOSEFONT16
,
*
LPCHOOSEFONT16
;
typedef
struct
{
UINT
lStructSize
;
HWND
hwndOwner
;
HDC
hDC
;
...
...
@@ -443,35 +361,9 @@ DECL_WINELIB_TYPE_AW(LPCHOOSEFONT)
(void)SNDMSG(_hdlg, CDM_SETDEFEXT, 0, (LPARAM)(LPSTR)_pszext)
typedef
UINT16
(
CALLBACK
*
LPPRINTHOOKPROC16
)
(
HWND16
,
UINT16
,
WPARAM16
,
LPARAM
);
typedef
UINT
(
CALLBACK
*
LPPRINTHOOKPROC
)
(
HWND
,
UINT
,
WPARAM
,
LPARAM
);
typedef
UINT16
(
CALLBACK
*
LPSETUPHOOKPROC16
)
(
HWND16
,
UINT16
,
WPARAM16
,
LPARAM
);
typedef
UINT
(
CALLBACK
*
LPSETUPHOOKPROC
)
(
HWND
,
UINT
,
WPARAM
,
LPARAM
);
typedef
struct
{
DWORD
lStructSize
;
HWND16
hwndOwner
;
HGLOBAL16
hDevMode
;
HGLOBAL16
hDevNames
;
HDC16
hDC
;
DWORD
Flags
;
WORD
nFromPage
;
WORD
nToPage
;
WORD
nMinPage
;
WORD
nMaxPage
;
WORD
nCopies
;
HINSTANCE16
hInstance
;
LPARAM
lCustData
;
LPPRINTHOOKPROC16
lpfnPrintHook
;
LPSETUPHOOKPROC16
lpfnSetupHook
;
SEGPTR
lpPrintTemplateName
;
SEGPTR
lpSetupTemplateName
;
HGLOBAL16
hPrintTemplate
;
HGLOBAL16
hSetupTemplate
;
}
PRINTDLG16
,
*
LPPRINTDLG16
;
typedef
struct
tagPDA
{
DWORD
lStructSize
;
...
...
@@ -544,6 +436,7 @@ DECL_WINELIB_TYPE_AW(LPPRINTDLG)
#define PD_USEDEVMODECOPIESANDCOLLATE 0x00040000
#define PD_DISABLEPRINTTOFILE 0x00080000
#define PD_HIDEPRINTTOFILE 0x00100000
#define PD_NONETWORKBUTTON 0x00200000
typedef
struct
{
UINT16
wDriverOffset
;
...
...
@@ -625,57 +518,35 @@ DECL_WINELIB_TYPE_AW(LPPAGESETUPDLG)
#define PSD_ENABLEPAGEPAINTHOOK 0x00040000
#define PSD_DISABLEPAGEPAINTING 0x00080000
BOOL16
WINAPI
ChooseColor16
(
LPCHOOSECOLOR16
lpChCol
);
BOOL
WINAPI
ChooseColorA
(
LPCHOOSECOLORA
lpChCol
);
BOOL
WINAPI
ChooseColorW
(
LPCHOOSECOLORW
lpChCol
);
#define ChooseColor WINELIB_NAME_AW(ChooseColor)
DWORD
WINAPI
CommDlgExtendedError
(
void
);
HWND16
WINAPI
FindText16
(
SEGPTR
find
);
HWND
WINAPI
FindTextA
(
LPFINDREPLACEA
lpFind
);
HWND
WINAPI
FindTextW
(
LPFINDREPLACEW
lpFind
);
#define FindText WINELIB_NAME_AW(FindText)
INT16
WINAPI
GetFileTitle16
(
LPCSTR
lpFile
,
LPSTR
lpTitle
,
UINT16
cbBuf
);
INT16
WINAPI
GetFileTitleA
(
LPCSTR
lpFile
,
LPSTR
lpTitle
,
UINT
cbBuf
);
INT16
WINAPI
GetFileTitleW
(
LPCWSTR
lpFile
,
LPWSTR
lpTitle
,
UINT
cbBuf
);
short
WINAPI
GetFileTitleA
(
LPCSTR
lpFile
,
LPSTR
lpTitle
,
UINT
cbBuf
);
short
WINAPI
GetFileTitleW
(
LPCWSTR
lpFile
,
LPWSTR
lpTitle
,
UINT
cbBuf
);
#define GetFileTitle WINELIB_NAME_AW(GetFileTitle)
BOOL16
WINAPI
GetOpenFileName16
(
SEGPTR
ofn
);
BOOL
WINAPI
GetOpenFileNameA
(
LPOPENFILENAMEA
ofn
);
BOOL
WINAPI
GetOpenFileNameW
(
LPOPENFILENAMEW
ofn
);
BOOL
WINAPI
GetFileDialog95A
(
LPOPENFILENAMEA
ofn
,
UINT
iDlgType
);
BOOL
WINAPI
GetFileDialog95W
(
LPOPENFILENAMEW
ofn
,
UINT
iDlgType
);
#define GetOpenFileName WINELIB_NAME_AW(GetOpenFileName)
BOOL16
WINAPI
GetSaveFileName16
(
SEGPTR
ofn
);
BOOL
WINAPI
GetSaveFileNameA
(
LPOPENFILENAMEA
ofn
);
BOOL
WINAPI
GetSaveFileNameW
(
LPOPENFILENAMEW
ofn
);
#define GetSaveFileName WINELIB_NAME_AW(GetSaveFileName)
BOOL
WINAPI
PageSetupDlgA
(
LPPAGESETUPDLGA
);
BOOL
WINAPI
PageSetupDlgW
(
LPPAGESETUPDLGW
);
#define PageSetupDlg WINELIB_NAME_AW(PageSetupDlg)
BOOL16
WINAPI
PrintDlg16
(
LPPRINTDLG16
print
);
BOOL
WINAPI
PrintDlgA
(
LPPRINTDLGA
printdlg
);
BOOL
WINAPI
PrintDlgW
(
LPPRINTDLGW
printdlg
);
#define PrintDlg WINELIB_NAME_AW(PrintDlg)
HWND16
WINAPI
ReplaceText16
(
SEGPTR
find
);
HWND
WINAPI
ReplaceTextA
(
LPFINDREPLACEA
lpFind
);
HWND
WINAPI
ReplaceTextW
(
LPFINDREPLACEW
lpFind
);
#define ReplaceText WINELIB_NAME_AW(ReplaceText)
BOOL16
WINAPI
ChooseFont16
(
LPCHOOSEFONT16
);
BOOL
WINAPI
ChooseFontA
(
LPCHOOSEFONTA
);
BOOL
WINAPI
ChooseFontW
(
LPCHOOSEFONTW
);
#define ChooseFont WINELIB_NAME_AW(ChooseFont)
LRESULT
WINAPI
FileOpenDlgProc16
(
HWND16
hWnd
,
UINT16
wMsg
,
WPARAM16
wParam
,
LPARAM
lParam
);
LRESULT
WINAPI
FileSaveDlgProc16
(
HWND16
hWnd
,
UINT16
wMsg
,
WPARAM16
wParam
,
LPARAM
lParam
);
LRESULT
WINAPI
ColorDlgProc16
(
HWND16
hWnd
,
UINT16
wMsg
,
WPARAM16
wParam
,
LPARAM
lParam
);
LRESULT
WINAPI
FindTextDlgProc16
(
HWND16
hWnd
,
UINT16
wMsg
,
WPARAM16
wParam
,
LPARAM
lParam
);
LRESULT
WINAPI
ReplaceTextDlgProc16
(
HWND16
hWnd
,
UINT16
wMsg
,
WPARAM16
wParam
,
LPARAM
lParam
);
LRESULT
WINAPI
PrintDlgProc16
(
HWND16
hWnd
,
UINT16
wMsg
,
WPARAM16
wParam
,
LPARAM
lParam
);
LRESULT
WINAPI
PrintDlgProcA
(
HWND
hWnd
,
UINT
wMsg
,
WPARAM
wParam
,
LPARAM
lParam
);
LRESULT
WINAPI
PrintDlgProcW
(
HWND
hWnd
,
UINT
wMsg
,
WPARAM
wParam
,
LPARAM
lParam
);
LRESULT
WINAPI
PrintSetupDlgProc16
(
HWND16
hWnd
,
UINT16
wMsg
,
WPARAM16
wParam
,
LPARAM
lParam
);
LRESULT
WINAPI
FormatCharDlgProc16
(
HWND16
,
UINT16
,
WPARAM16
,
LPARAM
);
LRESULT
WINAPI
FormatCharDlgProcA
(
HWND
,
UINT
,
WPARAM
,
LPARAM
);
LRESULT
WINAPI
FormatCharDlgProcW
(
HWND
,
UINT
,
WPARAM
,
LPARAM
);
#define FormatCharDlgProc WINELIB_NAME_AW(FormatCharDlgProc)
void
COMDLG32_SetCommDlgExtendedError
(
DWORD
err
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment