on 01-08-2017 2:12 AM
I'm trying to use external function OpenPrinterA, but it
keeps failing.
Local external function is:
Function Long WritePrinterB(Long Handle, Ref Blob pData, Long pDataLen, Ref Long BytesWritten) Library "winspool.drv" Alias For "WritePrinter;ansi"
FUNCTION long GetErrMessage (Long dwFlags ,ref Any lpSource , Long dwMessageId, Long dwLanguageId, ref String lpBuffer, Long nSize , Long Arguments) LIBRARY "kernel32.dll" ALIAS FOR "FormatMessageA"
Function Long OpenPrinter(String PrinterName, Ref Long Handle, Long Defaults) library "winspool.drv" alias for "OpenPrinterA"
Function Long ClosePrinter(Long Handle) Library "winspool.drv"
Function Long WritePrinter(Long Handle, Ref Char pData[], Long pDataLen, Ref Long BytesWritten) Library "winspool.drv" Alias For "WritePrinter;ansi"
Function Long WritePrinterS(Long Handle, Ref String pData, Long pDataLen, Ref Long BytesWritten) Library "winspool.drv" Alias For "WritePrinter;ansi"
Function Long StartPagePrinter(Long Handle) Library "winspool.drv"
Function Long EndPagePrinter(Long Handle) Library "winspool.drv"
Function Long EndDocPrinter(Long Handle) Library "winspool.drv"
Function Long AbortPrinter(Long Handle) Library "winspool.drv"
Function Long GetLastError() Library "Kernel32.dll"
Function Long StartDocPrinter(Long Handle, Long Level, Ref DocInfo DI) Library "winspool.drv" alias for "StartDocPrinterW"
of_print()
Long PrinterHandle
li_ret = OpenPrinter(as_printer,PrinterHandle,0)
If li_ret <> 0 then
Return li_ret
End If
li_ret
is always 0. What am I doing wrong?
You are using OpenPrinterA without specifying ansi. Try changing it to OpenPrinterW.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.