Bonjour, je d�sire faire un application qui imprime avec une fen�tre modifi�e disponible dans les resources. J'ai r�ussi � en faire avec PrintDlg, mais je n'y arrive pas avec PrintDlgEx. Il est important pour le look d'utiliser PrintDlgEx.
Je n'ai trouv� aucun exemple qui utlise lpPrintTemplateName lpCallback, et hInstance. Dans tout les exemples, c'est valeur sont NULL
Voici mon code:
Exemple (sans fen�tre custom):
Code : S�lectionner tout - Visualiser dans une fen�tre � part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40 BOOL bResult = FALSE; LPPRINTDLGEXW ptPrt = NULL; LPPRINTPAGERANGE ptPageRanges = NULL; ptPrt = calloc(1, sizeof(PRINTDLGEXW)); ptPageRanges = calloc(10, sizeof(PRINTPAGERANGE)); ptPrt->lStructSize = sizeof(PRINTDLGEXW); ptPrt->hwndOwner = gtPPMreportHWnd; ptPrt->hDevMode = NULL; ptPrt->hDevNames = NULL; ptPrt->hDC = NULL; //ptPrt->Flags = PD_USEDEVMODECOPIESANDCOLLATE | PD_RETURNDC | // PD_ENABLEPRINTTEMPLATE | PD_NOPAGENUMS;; ptPrt->Flags = PD_RETURNDC | PD_COLLATE | PD_ENABLEPRINTTEMPLATE | PD_ENABLEPRINTTEMPLATEHANDLE; ptPrt->Flags2 = 0; ptPrt->ExclusionFlags = 0; ptPrt->nPageRanges = 0; ptPrt->nMaxPageRanges = 10; ptPrt->lpPageRanges = ptPageRanges; ptPrt->nMinPage = 1; ptPrt->nMaxPage = 1000; ptPrt->nCopies = 1; ptPrt->hInstance = gtAppHInst; ptPrt->lpCallback = (IUnknown*)PrintDlgProc; ptPrt->nPropertyPages = 0; ptPrt->lphPropertyPages = NULL; ptPrt->nStartPage = START_PAGE_GENERAL; ptPrt->dwResultAction = 0; ptPrt->lpPrintTemplateName = (LPWSTR)MAKEINTRESOURCEW(IDR_PRNTDLG); bResult = !PrintDlgExW((LPPRINTDLGEXW)ptPrt); *phPrtDC = ptPrt->hDC; if(ptPrt!=NULL) free(ptPrt); if(ptPageRanges!=NULL) free(ptPageRanges); return bResult;
http://msdn.microsoft.com/library/de...ialogboxes.asp
Merci![]()
Partager