F
fujing1003
Sub GetPrintInfo()
Dim lWidth As Long
Dim lHeight As Long
Dim PrinterName As String
Dim PrinterHandle As Long
Dim PrintInfo As PRINTER_DEFAULTS
PrinterName = GetDefaultPrinterName
OpenPrinter PrinterName, PrinterHandle, PrintInfo
lWidth = GetDeviceCaps(PrinterHandle, 8)
lHeight = GetDeviceCaps(PrinterHandle, 10)
MsgBox "Width=" & lWidth & vbCrLf & "Height=" & lHeight
End Sub
use the above sub to get printable area of the page, I've already get
the PrinterHandle,but failed to get lWidth and lHeight .
According to
http://msdn2.microsoft.com/en-us/library/ms533266.aspx
"Do not call this method to get printer capabilities from an XPSDrv
driver. Instead, use the DrvDeviceCapabilities function"
so I try to use DrvDeviceCapabilities instead of GetDeviceCaps, but
can't know which library it is in. the msdn don't tell this.
http://msdn2.microsoft.com/en-us/library/bb734109.aspx
Dim lWidth As Long
Dim lHeight As Long
Dim PrinterName As String
Dim PrinterHandle As Long
Dim PrintInfo As PRINTER_DEFAULTS
PrinterName = GetDefaultPrinterName
OpenPrinter PrinterName, PrinterHandle, PrintInfo
lWidth = GetDeviceCaps(PrinterHandle, 8)
lHeight = GetDeviceCaps(PrinterHandle, 10)
MsgBox "Width=" & lWidth & vbCrLf & "Height=" & lHeight
End Sub
use the above sub to get printable area of the page, I've already get
the PrinterHandle,but failed to get lWidth and lHeight .
According to
http://msdn2.microsoft.com/en-us/library/ms533266.aspx
"Do not call this method to get printer capabilities from an XPSDrv
driver. Instead, use the DrvDeviceCapabilities function"
so I try to use DrvDeviceCapabilities instead of GetDeviceCaps, but
can't know which library it is in. the msdn don't tell this.
http://msdn2.microsoft.com/en-us/library/bb734109.aspx