|
为了获取指定打印机的句柄, 用以下语句:
Dim pd As PRINTER_DEFAULTS
Dim PrinterHandle As Long
Dim Result As Long
Dim PrinterName As String
pd.pDataType = vbNullString
pd.pDevMode = 0&
pd.DesiredAccess = PRINTER_ALL_ACCESS
PrinterName="Canno S220SP"
Result = OpenPrinter2(PrinterName, PrinterHandle, pd)
对于本地打印机名:
PrinterName="Canno S220SP"
执行是成功的,
但是把这个打印机共享了, 在另一台机器上通过网络打印机名:
PrinterName="\\A003\Canno S220SP"
来获取PrinterHandle, 却是怎么也不行!
请教大侠, 如何用OpenPrinter2获取网络上打印机的PrinterHandle?
|
|