Re: getting the default printer
From: Ken Tucker [MVP] (vb2ae_at_bellsouth.net)
Date: 12/02/04
- Next message: Sahil Malik: "Re: best way to retrieve thousands of records."
- Previous message: Herfried K. Wagner [MVP]: "Re: SolidBrush, coloring graphics gives unexpected result"
- In reply to: Geraldine Hobley: "getting the default printer"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 2 Dec 2004 09:08:05 -0500
Hi,
You need to look up the wmi class to get a list of methods.
mo("Default") will return true if the printer is the default printer.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_printer.asp
Ken
-------------------
"Geraldine Hobley" <GeraldineHobley@discussions.microsoft.com> wrote in
message news:40C85A92-010E-4FA8-A196-47B1E61EEA82@microsoft.com...
Hello,
I have the following code that sets the default printer using the WMI
(windows management system).
' Add a Reference to System.Management
Dim moReturn As Management.ManagementObjectCollection
Dim moSearch As Management.ManagementObjectSearcher
Dim mo As Management.ManagementObject
moSearch = New Management.ManagementObjectSearcher("Select * from
Win32_Printer")
moReturn = moSearch.Get
For Each mo In moReturn
If CType(mo("Name"), String) = Me.cboPrinter.Text Then
mo.InvokeMethod("SetDefaultPrinter", Nothing)
Exit For
End If
Next
This works fine, however, how do I get the default printer. How do I know
what methods Invokemethod accepts? Intellisense doesn't tell me.
Geri.
- Next message: Sahil Malik: "Re: best way to retrieve thousands of records."
- Previous message: Herfried K. Wagner [MVP]: "Re: SolidBrush, coloring graphics gives unexpected result"
- In reply to: Geraldine Hobley: "getting the default printer"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|