Re: getting the default printer

From: Ken Tucker [MVP] (vb2ae_at_bellsouth.net)
Date: 12/02/04


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.



Relevant Pages

  • getting the default printer
    ... (windows management system). ... ' Add a Reference to System.Management ... what methods Invokemethod accepts? ... Geri. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Writing my 1st VBS "Script Component"
    ... "Justin Piper" wrote: ... component's reference count might decrease. ... I'm not positive, since I rarely an editor that has IntelliSense support, ... I thought I might somehow use Script Components or Scriptlets ...
    (microsoft.public.scripting.vbscript)
  • Re: References for VBA
    ... >>> in Access, it's the mso constants that aren't defined, so ... ... >> Why would that give a good indication of the reference that was ... > then as soon as I type that "(" I get the IntelliSense dropdown list ... > Jean-Guy Marcil - Word MVP ...
    (microsoft.public.word.vba.userforms)
  • Re: Annoyance: Intellisense doesnt work for referenced typed data
    ... Rebuild project and hopefully the intellisense will come back... ... go to reference will often jump to the wrong reference.cs... ... > Original post was made by Mike in MSDN newsgroup: ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: How can call .Net written COM from VC6
    ... I could use those COM easily from VB6 (just reg. ... > Reference, and intellisense shows) ... Just mark the assembly as COM visible (using the ...
    (microsoft.public.dotnet.framework.interop)