VFP9的BUG?——PRTINFO()函数的问题!
系统环境:Windows Server 2003 sp2 + VFP9 sp2 (7423)
需要获得当前默认打印机所选纸张的纸宽和纸高,然而无论在打印设置中选择的是什么规格的纸张,使用PRTINFO()函数获得的纸宽和纸高值竟然都是-1。代码为:
#DEFINE PRT_PAPERSIZE 2
#DEFINE PRT_PAPERLENGTH 3
#DEFINE PRT_PAPERWIDTH 4
MESSAGEBOX(;
"Paper size :" + TRANSFORM(PRTINFO(PRT_PAPERSIZE)) + CHR(13) + ;
"Paper width :" + TRANSFORM(PRTINFO(PRT_PAPERWIDTH)) + CHR(13) + ;
"Paper height :" + TRANSFORM(PRTINFO(PRT_PAPERLENGTH)) + CHR(13) + CHR(13) + ;
"Paper size :" + TRANSFORM(PRTINFO(2)) + CHR(13) + ;
"Paper width :" + TRANSFORM(PRTINFO(4)) + CHR(13) + ;
"Paper height :" + TRANSFORM(PRTINFO(3)),;
64,"Printer info")
CPrintDialog printDlg(FALSE);
if(!printDlg.GetDefaults())
{
MessageBox("您的系统上没有安装打印机!","默认打印机",MB_OK);
return FALSE;
}
CString strPrinter("");
LPDEVMODE pDevMode = printDlg.GetDevMode();
strPrinter.Format("默认打印机:%s,端口:%s,驱动:%s\r\nPaperSize:%d,PaperWidth:%d,PaperLength:%d",
printDlg.GetDeviceName(),printDlg.GetPortName(),printDlg.GetDriverName(),
pDevMode->dmPaperSize,pDevMode->dmPaperWidth,pDevMode->dmPaperLength);
MessageBox(strPrinter,"默认打印机信息",MB_OK);