Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Determing True Printer Port
Message
General information
Forum:
Visual Basic
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00441561
Message ID:
00441570
Views:
14
>Does anyone know how to determine the true port of a printer? I am developing under Win2K, and when I issue printer.port, I get a useless "Ne01:" or the like. What I need to know is if the printer is a local printer or a networked printer and if the printer is networked, what port it is connected to. For example, If I am sharing an HP Printer on Box A: I would like to be able to retreive the string: "\\A\HP" The same goes for a local printer: "LPT1:"
>

You can call the Win32 API function WNetGetConnection() to retrieve the UNC of a shared device; if the device name is local, then the return from WNetGetConnection() is null, and the port is the port AFA Windows is concerned.

You can also use ADSI, or the Wscript.Network COM object to return the UNCs of shares at your station.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform