Windows/Windows API

프린트 셋업 페이지

aucd29 2013. 10. 1. 18:55
PAGESETUPDLG psd;    // common dialog box structure
HWND hwnd;         // owner window

// Initialize PAGESETUPDLG
ZeroMemory(&psd, sizeof(psd));
psd.lStructSize = sizeof(psd);
psd.hwndOwner = hwnd;
psd.hDevMode    = NULL; // Don't forget to free or store hDevMode
psd.hDevNames = NULL; // Don't forget to free or store hDevNames
psd.Flags     = PSD_INTHOUSANDTHSOFINCHES | PSD_MARGINS |
                 PSD_ENABLEPAGEPAINTHOOK;
psd.rtMargin.top = 1000;
psd.rtMargin.left = 1250;
psd.rtMargin.right = 1250;
psd.rtMargin.bottom = 1000;
psd.lpfnPagePaintHook = PaintHook;

if (PageSetupDlg(&psd)==TRUE) {
    // check paper size and margin values here
}