Hi,

I need to add a TCP/IP printer programmatically.

I have done the following steps and struck somewhere in the middle,

1. Using the API "OpenPrinter" and with arguments ",XcvMonitor
Standard TCP/IP Port" I have obtained a printer handle.
2. Using the API "XcvData" I have filled the PORT_DATA_1 structure
with the necessary arguments. And a TCP/IP port gets created, which
can be viewed in the "Control Panel -> Printers" and right-click and
viewing the "Ports" tab.

I'm unable to proceed after this. I couldn't find any related
documentation also in this respect.

Any help in this regard would be highly appreciated.

Thanks,
Mike

RE: Adding a TCP/IP printer programmatically! by Kiran

Kiran
Mon Nov 08 23:10:03 CST 2004

AddPrinter().
Get pPortName of PRINTER_INFO_2 from pPortName of PORT_INFO_2. You can
obtain Port info from EnumPorts.

-Kiran

Re: Adding a TCP/IP printer programmatically! by mkvaugh

mkvaugh
Wed Nov 17 07:38:20 CST 2004

Hi,

Thanks for the info.

I'm confused a little. The TCP/IP printer port created through my
code which is of the form IP_<IP_NAME> gets successfully listed in the
Server Properties dialog. Now why should I use the EnumPorts function
to obtain the same to fill the PRINTER_INFO_2 structure?

I use the "AddPrinter" function separately by filling-in the necessary
values(hardcoded) like portName, printerName, driverName and
printProcessor which works like a gem.

I'm aware of the details like portName, printProcessor and
printerName, now how do I get the driverName? How do I communicate to
the printer(through any Windows API) to get the driver details? I just
have a TCP/IP port opened in the local machine, doesn't know the
printer name but know the IP of the printer.

Can somebody help?

TIA,
Mike

"Kiran" <Kiran@discussions.microsoft.com> wrote in message news:<2E1FF8F9-BCFA-4906-9A1F-4DD7B9CE1F69@microsoft.com>...
> AddPrinter().
> Get pPortName of PRINTER_INFO_2 from pPortName of PORT_INFO_2. You can
> obtain Port info from EnumPorts.
>
> -Kiran

Re: Adding a TCP/IP printer programmatically! by mkvaugh

mkvaugh
Wed Nov 17 08:11:42 CST 2004

Hi,

Thanks for the info.

I'm confused a little. The TCP/IP printer port created through my
code which is of the form IP_<IP_NAME> gets successfully listed in the
Server Properties dialog. Now why should I use the EnumPorts function
to obtain the same to fill the PRINTER_INFO_2 structure?

I use the "AddPrinter" function separately by filling-in the necessary
values(hardcoded) like portName, printerName, driverName and
printProcessor which works like a gem.

I'm aware of the details like portName, printProcessor and
printerName, now how do I get the driverName? How do I communicate to
the printer(through any Windows API) to get the driver details? I just
have a TCP/IP port opened in the local machine, doesn't know the
printer name but know the IP of the printer.

Can somebody help?

TIA,
Mike

"Kiran" <Kiran@discussions.microsoft.com> wrote in message news:<2E1FF8F9-BCFA-4906-9A1F-4DD7B9CE1F69@microsoft.com>...
> AddPrinter().
> Get pPortName of PRINTER_INFO_2 from pPortName of PORT_INFO_2. You can
> obtain Port info from EnumPorts.
>
> -Kiran