I failed to mention that the printer is not installed yet. This is a
driver/printer installation program.
I found out that using UpdateDriverForPlugAndPlayDevices will work to
install the printer on whatever port it is connected to and so I don't really
need to know what port using this method. After the printer is installed your
method would work fine, thanks for the info.
"Matt Kane" wrote:
> EnumPrinters with the appropriate flags and level = 2
> OR
> GetPrinter with level 2 if you already have a handle to it.
> "Tim D" wrote:
>
> > How can I determine the port that a printer is connected to? For example
> > during a printer driver installation program I want to be able to determine
> > if the printer is connected to LPT1 or USB004 or whatever parallel or usb
> > port the particular printer that is being installed may be connected to.
> > Also, if a "Virtual printer port for USB" is not already created for the
> > printer then create one.
> >
> > Any ideas?
> >
> > Thanks!
|