PDA

View Full Version : Open Printer MSDN API Call Fail



lmilesuk
01-27-2015, 10:24 AM
I've tried everything I can think of but I'm unable to get OpenPrinter API to work in my BasicMsi



prototype BOOL SETUPAPI.OpenPrinterW(
WSTRING, //_In_ LPTSTR pPrinterName,
NUMBER,//_Out_ LPHANDLE phPrinter,
WPOINTER//_In_ LPPRINTER_DEFAULTS pDefault
);

try
OpenPrinterW(szDriverName, Printer, NULL);


catch
Err = GetLastError();
SprintfBox (INFORMATION, "L862Error","Error occured: %i\n\n%s\n\n%s", Err.Number, Err.Description, Err.LastDllError);

endcatch;

I always get a -2147219709 returned, I've also tried using OpenPrinterA and OpenPrinter but same error everytime.

Does anyone have any idea's as to what I may be doing wrong?