lmilesuk
lmilesuk

Reputation: 1

Basic Msi OpenPrinter API issue

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?

Upvotes: 0

Views: 98

Answers (1)

PeterI
PeterI

Reputation: 492

I suspect it's this error: ERROR_PRINTER_DRIVER_ALREADY_INSTALLED 1795 (0x703) The specified printer driver is already installed

I converted your error number into hex and it's 80040703 which is where I've gotten 703 from (8004 means it's an error in FACIILITY_ITF)

not sure if this helps... but it might get you started. I wonder if this is some sort of problem where msiexec can't see the printer so tries to install it.

Upvotes: 0

Related Questions