Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

API funtion to retrieve printers same as Print Setup

Status
Not open for further replies.

theogary

Programmer
Mar 3, 2003
99
US
Is there a API funtion to retrieve the printers a user's machinge has set up. Example: User(John) has 3 printers set up. I want to list all three machines in a list box or dropdown list box
 
Theogary

Depending on what platfome your are writting, some thing like this would do it.

Code:
Set WshNetwork = WScript.CreateObject("WScript.Network")
Set oPrinters = WshNetwork.EnumPrinterConnections

For i = 0 to oPrinters.Count - 1 Step 2
   WScript.Echo "Port " & oPrinters.Item(i) & " = " & oPrinters.Item(i+1)
Next

Or this

Code:
BOOL EnumPrinters( 
  DWORD Flags,         // printer object types 
  LPTSTR Name,         // name of printer object 
  DWORD Level,         // information level 
  LPBYTE pPrinterEnum, // printer information buffer 
  DWORD cbBuf,         // size of printer information buffer 
  LPDWORD pcbNeeded,   // bytes received or required 
  LPDWORD pcReturned   // number of printers enumerated 
);


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top