Findong number of Com ports on a machine

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • rollasoc

    Findong number of Com ports on a machine

    Hi,

    Anyone know a way of working out the total number and which COM ports exist
    on a machine, using C#?

    rollasoc



  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: Findong number of Com ports on a machine

    rollasoc,

    Using the classes in the System.Manageme nt namespace, I would do a query
    for all instances of Win32_SerialPor t. This will return the information
    about the port, as well as the number of ports on the system.

    Hope this helps.


    --
    - Nicholas Paldino [.NET/C# MVP]
    - mvp@spam.guard. caspershouse.co m

    "rollasoc" <hotmail@hotmai l.com> wrote in message
    news:u1t83rvnDH A.1948@TK2MSFTN GP12.phx.gbl...[color=blue]
    > Hi,
    >
    > Anyone know a way of working out the total number and which COM ports[/color]
    exist[color=blue]
    > on a machine, using C#?
    >
    > rollasoc
    >
    >
    >[/color]


    Comment

    • rollasoc

      #3
      Re: Findong number of Com ports on a machine

      Thank you Nicholas.

      "Nicholas Paldino [.NET/C# MVP]" <mvp@spam.guard .caspershouse.c om> wrote in
      message news:OFJoLxvnDH A.2200@TK2MSFTN GP12.phx.gbl...[color=blue]
      > rollasoc,
      >
      > Using the classes in the System.Manageme nt namespace, I would do a[/color]
      query[color=blue]
      > for all instances of Win32_SerialPor t. This will return the information
      > about the port, as well as the number of ports on the system.
      >
      > Hope this helps.
      >
      >
      > --
      > - Nicholas Paldino [.NET/C# MVP]
      > - mvp@spam.guard. caspershouse.co m
      >
      > "rollasoc" <hotmail@hotmai l.com> wrote in message
      > news:u1t83rvnDH A.1948@TK2MSFTN GP12.phx.gbl...[color=green]
      > > Hi,
      > >
      > > Anyone know a way of working out the total number and which COM ports[/color]
      > exist[color=green]
      > > on a machine, using C#?
      > >
      > > rollasoc
      > >
      > >
      > >[/color]
      >
      >[/color]


      Comment

      • rollasoc

        #4
        Re: Finding number of Com ports on a machine

        Hi,

        Ok, sussed how to find the 2 COM Ports on my motherboard ok, using
        System.Manageme nt namespace and looking for Win32_SerialPor t.

        Problem now, is I have 3 COM Ports on USB connections, but can't seem to
        find a way to query for them.

        Any suggestions?

        rollasoc


        "rollasoc" <hotmail@hotmai l.com> wrote in message
        news:uF4OAI5nDH A.964@TK2MSFTNG P10.phx.gbl...[color=blue]
        > Thank you Nicholas.
        >
        > "Nicholas Paldino [.NET/C# MVP]" <mvp@spam.guard .caspershouse.c om> wrote[/color]
        in[color=blue]
        > message news:OFJoLxvnDH A.2200@TK2MSFTN GP12.phx.gbl...[color=green]
        > > rollasoc,
        > >
        > > Using the classes in the System.Manageme nt namespace, I would do a[/color]
        > query[color=green]
        > > for all instances of Win32_SerialPor t. This will return the information
        > > about the port, as well as the number of ports on the system.
        > >
        > > Hope this helps.
        > >
        > >
        > > --
        > > - Nicholas Paldino [.NET/C# MVP]
        > > - mvp@spam.guard. caspershouse.co m
        > >
        > > "rollasoc" <hotmail@hotmai l.com> wrote in message
        > > news:u1t83rvnDH A.1948@TK2MSFTN GP12.phx.gbl...[color=darkred]
        > > > Hi,
        > > >
        > > > Anyone know a way of working out the total number and which COM ports[/color]
        > > exist[color=darkred]
        > > > on a machine, using C#?
        > > >
        > > > rollasoc
        > > >
        > > >
        > > >[/color]
        > >
        > >[/color]
        >
        >[/color]


        Comment

        Working...