jimmyzh
10/14/2003 6:08:00 AM
Hi Marijan,
Here are some code sample for launching the dialog with the margin size you
want to set. You can write native code as below to launch the Page Setup
Dialog:
PAGESETUPDLG pageSetupDlg;
BOOL ret;
POINT pt = {0, 0};
RECT margin = {3, 3, 3, 3};
RECT minmargin = {1, 1, 1, 1};
pageSetupDlg.lStructSize = sizeof(PAGESETUPDLG);
pageSetupDlg.hwndOwner = hWnd;
pageSetupDlg.hDevMode = NULL;
pageSetupDlg.hDevNames = NULL;
pageSetupDlg.Flags = PSD_MARGINS | PSD_INTHOUSANDTHSOFINCHES;
pageSetupDlg.ptPaperSize = pt;
pageSetupDlg.rtMinMargin = minmargin;
pageSetupDlg.rtMargin = margin;
pageSetupDlg.hInstance = NULL;
pageSetupDlg.lCustData = 0;
pageSetupDlg.lpfnPageSetupHook = NULL;
pageSetupDlg.lpfnPagePaintHook = NULL;
pageSetupDlg.lpPageSetupTemplateName = NULL;
pageSetupDlg.hPageSetupTemplate = NULL;
ret = PageSetupDlg(&pageSetupDlg);
The margins are set to 3 inches each. And you can change the margin
variable to the size you want. Hope this can help you.
Jimmy Zhu
Microsoft Developer Support
This posting is provided "AS IS" with no warranties, and confers no rights.
Please reply to newsgroups only. Thanks.