Several weeks ago I was investigating this exact problem. PrintDlgEx uses a new PRINTDLGEX parameter structure that is incompatible with PrintDlg's
new PRINTDLG. If we can implement an even semi-functional PrintDlgEx, it would probably go a long way towards solving printing issues in many new apps.
KernelEx currently has a stub for PrintDlgEx that just returns an error. That stub could be rewritten to call PrintDlg, translating between parameter structures.
I think I can patch comdlg32.dll to export PrintDlgEx instead of PrintDlg and inject the needed translation code into the existing function. This patched version would no longer export PrintDlg, so would have to be stored local to the app (not in <system>); or it could be renamed comdlgex.dll and apps would need to have their imports patched to access it.
I have also been considering ways to inject the needed translation code directly into the calling app.
Another possibility is to redirect the call, not to PrintDlg, but to the custom print dialog of another (MS?) app. If we can find one that uses the new PRINTDLGEX structure, that would be ideal.
Research in this area would be very helpful
MSDN: PRINTDLG
typedef struct tagPD {
DWORD lStructSize;
HWND hwndOwner;
HGLOBAL hDevMode;
HGLOBAL hDevNames;
HDC hDC;
DWORD Flags;
WORD nFromPage;
WORD nToPage;
WORD nMinPage;
WORD nMaxPage;
WORD nCopies;
HINSTANCE hInstance;
LPARAM lCustData;
LPPRINTHOOKPROC lpfnPrintHook;
LPSETUPHOOKPROC lpfnSetupHook;
LPCTSTR lpPrintTemplateName;
LPCTSTR lpSetupTemplateName;
HGLOBAL hPrintTemplate;
HGLOBAL hSetupTemplate;
} PRINTDLG, *LPPRINTDLG;
MSDN: PRINTDLGEX
typedef struct tagPDEX {
DWORD lStructSize;
HWND hwndOwner;
HGLOBAL hDevMode;
HGLOBAL hDevNames;
HDC hDC;
DWORD Flags;
DWORD Flags2;
DWORD ExclusionFlags;
DWORD nPageRanges;
DWORD nMaxPageRanges;
LPPRINTPAGERANGE lpPageRanges;
DWORD nMinPage;
DWORD nMaxPage;
DWORD nCopies;
HINSTANCE hInstance;
LPCTSTR lpPrintTemplateName;
LPUNKNOWN lpCallback;
DWORD nPropertyPages;
HPROPSHEETPAGE *lphPropertyPages;
DWORD nStartPage;
DWORD dwResultAction;
} PRINTDLGEX, *LPPRINTDLGEX;
This post has been edited by jumper: 16 February 2012 - 03:15 AM