Tom's Hardware > Forum > Windows 2000/NT > Windows 2000/NT General Discussion > setting a printer up via program instead of via the "Add P..
Word :    Username :           
 

Archived from groups: microsoft.public.windowsnt.print (More info?)

 

I have to be able to programitically set up a printer without user
intervention for some remote setup things I am doing. I am using
AddPrinter() and all is working well if the port specified in the
PRINTER_INFO_2->pPortName exists. However, in one scenario I must deal with
it does not.

I need to do the programmatic equivalent of the step in the "Add Printer
Wizard" process where, after I select a local printer and press "Next" I am
on the "Select the Printer Port" dialog and I select "Create a new port",
select "local port" from the dropdown and press "Next", where it asks for
the port name. At this point I plug in some unique string to create a new
"port".

Here is my dilemma. If I do the Win32 AddPrinter() I must have an existing
printer port defined or the call will fail. So, so far as I can tell I must
call XcvData() if I do not want a box to pop up to get info from the user.
This is especially important since there will be no user. However, the
XcvData parameter 1 is a caller supplied printer handle which I don't yet
have since I cannot call AddPrinter to get the printer handle without the
XcvData(). It seems to be a chicken and egg situation. Am I missing
something?

Thanks in advance for any help.

--
Brian McCormick
mccorb@cox.net

Sponsored Links
Register or log in to remove.
Tom's Hardware > Forum > Windows 2000/NT > Windows 2000/NT General Discussion > setting a printer up via program instead of via the "Add P..
Go to:

There are 1085 identified and unidentified users. To see the list of identified users, Click here.

Please mind

You are about to answer a thread that has been inactive for more than 6 months.
If you still wish to proceed, please ensure that your posting is original and does not duplicate or overlap any prior responses to this thread.

Add a reply Cancel
Sponsored links
  • Ask the community now
  • Publish
Ad
They won a badge
Join us in greeting them