>>351
こんな感じか?

PRINTER_INFO_2 *GetDefaultDevMode(LPTSTR name){
PRINTER_INFO_2 *pinfo2 = NULL;
HANDLE hPrinter;
if (OpenPrinter(name, &hPrinter, NULL)){
DWORD size;
GetPrinter(hPrinter, 2, NULL, 0, &size);
if (GetLastError() == ERROR_INSUFFICIENT_BUFFER){
pinfo2 = (PRINTER_INFO_2 *)malloc(size);
if (!GetPrinter(hPrinter, 2, (LPBYTE)pinfo2, size, &size)){
free(pinfo2);
pinfo2 = NULL;
}
}
ClosePrinter(hPrinter);
}
return pinfo2;
}

HDC CreatePrinterDC(LPTSTR name){
PRINTER_INFO_2 *pinfo2;
HDC hdc;
pinfo2 = GetDefaultDevMode(name);
if (!pinfo2)
return NULL;
pinfo2->pDevMode->dmFields |= DM_PAPERSIZE | DM_ORIENTATION;
pinfo2->pDevMode->dmPaperSize = DMPAPER_B5;
pinfo2->pDevMode->dmOrientation = DMORIENT_PORTRAIT;
hdc = CreateDC(pinfo2->pDriverName, pinfo2->pPrinterName, NULL, pinfo2->pDevMode);
free(pinfo2);
return hdc;
}