Page 1 of 1

Sending a _PRINTER_INFO_2A to a dll

Posted: Tue Apr 22, 2008 12:32 pm
by mehran
I have a problem with installing a printer using "AddPrinterA" Api function. this function needs a pointer to a _PRINTER_INFO_2A object, so we have to create this object first, set it's fields and send it through AddPrinterA.
for example in delphi we can do this:

var
PrinterInfo : ^PRINTER_INFO_2A
begin
...
PrinterInfo^.pPortName := pchar('FILE:')
PrinterInfo^.pPrinterName:= pchar(sName);
...
AddPrinterA(nil, 2, PrinterInfo);
end;
I wonder if and how we can create this object in IA to use AddPrinterA function

Posted: Mon May 05, 2008 10:45 am
by Mateo
Sorry for the late reply.
No, I don't think you can create data structures in IA. What I did to get around this was write a couple of functions in a dll and then call the functions from IA using the Call DLL Function plug-in. Once you're in your function you can do pretty much whatever you want. I used C but you can use Delphi too as far as i know.

Thank you

Posted: Mon May 05, 2008 11:28 am
by mehran
Thank you for the answer, I'm gonna try this.