Private Declare Function OpenPrinter Lib 'winspool. drv' Alias 'OpenPrinterA' (ByVal pPrinterName As String, phPrinter As Long, pDefault As Any) As Long
Private Declare Function EnumJobs Lib 'winspool. drv' Alias 'EnumJobsA' (ByVal hPnnter As Long, ByVal FirstJob As Long, ByVal NoJobs As Long, ByVal Level As Long, pJob As Any, ByVal cdBuf As Long, pcbNeeded As Long, pcReturned As Long) As Long
Private Declare PtrSafe Function addjob Lib 'winspool. drv' Alias' AddJobA' (ByVal hPrinter As Long, ByVal Level As Long, pData As dy, ByVal cdBuf As Long, pcbNeeded As Long) As Long
Private Declare PtrSafe Function tjjob Lib'winspool. drv' Alias 'ScheduleJob' (ByVal hPrinter As Long, ByVal Jobld As Long) As Long
Private Type dy
path As String
id As Long
End type
Sub test ()
dim r As dy
OpenPrinter 'Fujitsu DPK890T', hPrinter, ByVal 0&
tr ='E: \123. txt
r.path = tr
r.id= 1
addjob hPrinter,1,r,10,5
shuchu = addjob (hPrinter,1,r,10,5)
Debug. Print shuchu
tjjob hPrinter, r.id
end sub
为什么上述API函数调用不成功,返回的值为0,无法直接打印相关的123.txt文件?
如何实现调用上述函数成功,实现打印功能?