473,657 Members | 2,270 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 1173
Hi,

You can use the wmi for that. The win32_portconne ctor class
contains the info you are looking for. Add a reference to
system.manageme nt.

Dim moReturn As Management.Mana gementObjectCol lection

Dim moSearch As Management.Mana gementObjectSea rcher

Dim mo As Management.Mana gementObject

moSearch = New Management.Mana gementObjectSea rcher("Select * from
Win32_PortConne ctor")

moReturn = moSearch.Get

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

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

Ken
----------------------
"EMW" <so*****@MikroZ oft.com> wrote in message
news:42******** ************@dr eader2.news.tis cali.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***@bellsout h.net> schreef in bericht
news:ec******** ******@tk2msftn gp13.phx.gbl...
Hi,

You can use the wmi for that. The win32_portconne ctor class
contains the info you are looking for. Add a reference to
system.manageme nt.

Dim moReturn As Management.Mana gementObjectCol lection

Dim moSearch As Management.Mana gementObjectSea rcher

Dim mo As Management.Mana gementObject

moSearch = New Management.Mana gementObjectSea rcher("Select * from
Win32_PortConne ctor")

moReturn = moSearch.Get

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

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

Ken
----------------------
"EMW" <so*****@MikroZ oft.com> wrote in message
news:42******** ************@dr eader2.news.tis cali.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
2460
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 to do this. The only problem is that it lists the asp file used to for example if i go to: "http://myserver/listing.asp" In the file listing will be "listing.asp" amongst a lot of marketing documents.
19
3304
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 = os.listdir(directory)
3
2040
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 anyone know of a way to do this ? Any URLs, code snippets, etc ?
1
2480
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 http://www.asp.net/webmatrix/tour/section1/addbasiccontrols.aspx. When testing the 2nd example, I accepted the default port (8080) for the WebMatrix web server and got the message "Port already in use ...".
23
4143
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 ///////////////////////////////////////////////////////////////////// #include <dos.h> #include <string.h> #include <stdio.h> #define PORTADDRESS 0x378 /* Enter Your Port Address Here */
25
3616
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 expecting my connection on a certain port. Specifically, I'm trying to write an FTP host, and I'm trying to implement the PORT command. From everything I've read, the client supplies the IP address and port number for where I'm supposed to connect...
1
1495
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 can be one minute or one hour) the Pretty Listing starts acting weird. For instance, if I start writing "for...", it changes it to f(o) r" or something like that. When that starts happening, I can't code at all and have to restart VS. Sometimes...
9
26029
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 SqlConnection(@"Network Library=DBMSSOCN;Data Source=(local)" + ",1433;Database=CATHYDB;User id=cathy;Password=pswd;"); When this code runs I can guarantee that everything about it will be
4
2099
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 received (through delegate).
5
3483
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 the directory my @valeu =@{$Files}; foreach my $file (parse_dir(\@valeu)) { @Files = $ftp->ls('-lR');
0
8323
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8838
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8739
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8613
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6176
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5638
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4329
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1732
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.