碰到一个远程桌面打印的问题
用下面这段程序获得打印机当前的纸张类型:
Printer.GetPrinter(Device, Driver, Port, hDMode);
pDMode := GlobalLock(hDMode);
FormID := pDMode.dmPaperSize;
case pDMode.dmOrientation of
1:
begin
w := pDMode.dmPaperWidth / 100;
h := pDMode.dmPaperLength / 100;
end;
2:
begin
h := pDMode.dmPaperWidth / 100;
w := pDMode.dmPaperLength / 100;
end;
end;
GlobalUnLock(hDMode);
上面的代码在连接本地打印机时没问题,在远程桌面中连接到会话中的打印机时就内存报错,不知道原因,请高手解答,谢谢