@nathand wrote:
OK, I think I can duplicate what you're seeing, with the snippet below. For any level other than 3, GetLastError returns error 124, "The system call level is not correct." No idea what that means. With level set to 3, the first call returns error 122, "The data area passed to a system call is too small." which makes sense, and the second call succeeds. If your setup matches this, then I would say that you have properly configured the function calls from the LabVIEW side, and you need to figure out what parameters you need to set to OpenPrinter/AddPrinter to get the right system level, whatever that is.
Both this sample and the sample Darin posted are almost exactly what my process is doing.
But for me, the return on the second GetPrinter is still 0.
My pcbNeeded for the first printer was 4544, but the pPrinter pointer returned an empty array out of the second GetPrinterA.
I am testing my default printer, which is a network printer.
I downreved my VI, attached, to 2012. Hopefully it works for you.
Thank you both.
Veni Vidi Duci