473,505 Members | 15,036 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Com port listing

EMW
Hi,

I'm looking for a way to get a list of all the com ports on a pc.
It doesn't matter if they are free or not or if they are virtual of
physical.

Who can help me?
I've tried google, but nothing clear yet...

rg,
Eric
Nov 21 '05 #1
2 1162
Hi,

You can use the wmi for that. The win32_portconnector class
contains the info you are looking for. 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_PortConnector")

moReturn = moSearch.Get

For Each mo In moReturn
Dim strOut As String
strOut = mo("ExternalReferenceDesignator").ToString
If strOut.Length < 1 Then
strOut = mo("InternalReferenceDesignator").ToString
End If
Debug.WriteLine(strOut)
Next

http://msdn.microsoft.com/library/de...tconnector.asp

Ken
----------------------
"EMW" <so*****@MikroZoft.com> wrote in message
news:42********************@dreader2.news.tiscali. nl...
Hi,

I'm looking for a way to get a list of all the com ports on a pc.
It doesn't matter if they are free or not or if they are virtual of
physical.

Who can help me?
I've tried google, but nothing clear yet...

rg,
Eric

Nov 21 '05 #2
EMW
Thanks!

"Ken Tucker [MVP]" <vb***@bellsouth.net> schreef in bericht
news:ec**************@tk2msftngp13.phx.gbl...
Hi,

You can use the wmi for that. The win32_portconnector class
contains the info you are looking for. 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_PortConnector")

moReturn = moSearch.Get

For Each mo In moReturn
Dim strOut As String
strOut = mo("ExternalReferenceDesignator").ToString
If strOut.Length < 1 Then
strOut = mo("InternalReferenceDesignator").ToString
End If
Debug.WriteLine(strOut)
Next

http://msdn.microsoft.com/library/de...tconnector.asp

Ken
----------------------
"EMW" <so*****@MikroZoft.com> wrote in message
news:42********************@dreader2.news.tiscali. nl...
Hi,

I'm looking for a way to get a list of all the com ports on a pc.
It doesn't matter if they are free or not or if they are virtual of
physical.

Who can help me?
I've tried google, but nothing clear yet...

rg,
Eric

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
2449
by: Chris | last post by:
Hi, Not sure if this is the right forum, but hopefully someone can help me. I am creating something for our intranet and i want to list the files and folders of a directory, i found some code...
19
3290
by: SU News Server | last post by:
I've struggled with this for quite a while and I'm am just not sure what is going on. I have the following code import os def buildList( directory='/Users/mkonrad' ) dirs = listing =...
3
2022
by: David Jacques | last post by:
I am trying to get a list of all files of a certain extension type on disk to do some processing in a loop. The code needs to be portable to UNIX, so I need to use plain c functionality. Does...
1
2476
by: Richard | last post by:
Hi, I'm running WebMatrix, v. 0.6.812, over WinXP/SP2 with .Net Framework 1.0 & 1.1. I'm following the examples in ASP.NET Web Matrix Project Guided Tour, specifically the 2nd example at...
23
4113
by: Marco | last post by:
Could anyone please tell me why the program has the following error? I copy the program from http://www.beyondlogic.org/parlcd/parlcd.htm ...
25
3595
by: bmearns | last post by:
Is it possible to specify which port to use as the outbound port on a connection? I have the IP address and port number for the computer I'm trying to connect to (not listening for), but it's...
1
1487
by: Johnny Jörgensen | last post by:
I've got a serious problem. I've got Visual Studio 2005 installed, and of course I'm using the Pretty Listing formatting function. When I start up VS, everything is fine, but after a while (which...
9
26019
by: Cathy | last post by:
I am using a System.Data.SqlClient.SqlConnection to connect to a SQL Server 2005 database. I instantiate the SqlConnection with a connection string... SqlConnection sqlConn = new...
4
2083
by: Shark | last post by:
Hi, I need a help. My application reads data from COM port, this data is then parsed and displyed on: 1. two plotters 2. text box. I'm using Invoke method to update UI when new data is...
5
3466
by: jain236 | last post by:
HI every body, i am always getting the following error while parsing a directory . i am reading a directory by doing ls and trying to find out the name,type,size, mtime and mode of files from...
0
7216
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7303
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7367
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7018
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7471
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5613
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4699
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
1
754
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
407
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.