473,698 Members | 2,601 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Finding number of Com ports on a machine

Hi,

I've worked out 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
Jul 21 '05 #1
2 1466
I do it by iterating through each possible COM port attempting to open each
one in turn. Something like this:

FOR nPort = 1 to MaxPorts
Attempt to open COM<nPort>
IF (it succeeded)
Add nPort to list of available ports
Close COM<nPort>
ENDIF
ENDFOR
"rollasoc" <ho*****@hotmai l.com> wrote in message
news:uV******** ******@TK2MSFTN GP10.phx.gbl...
Hi,

I've worked out 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

Jul 21 '05 #2
Ok there was a great article that touched on this sort of thing, I will also
state that I didn't try this but believe the article is relevant to your
problem/issue/question.

http://msdn.microsoft.com/library/de...us/dncodefun/h
tml/code4fun1210200 3.asp

Coding in the Blue Glow
Duncan Mackenzie
Microsoft Developer Network
December 11, 2003

He writes a number of nice articles on well stuff he feels like I guess.

Hope it helps.

-Evan

"rollasoc" <ho*****@hotmai l.com> wrote in message
news:uV******** ******@TK2MSFTN GP10.phx.gbl...
Hi,

I've worked out 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

Jul 21 '05 #3

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

Similar topics

8
1914
by: ben | last post by:
hello, i'm trying to answer a "prove an upper bound on the number of machine instructions required to process M connections on N objects" exercise from an algorithms book. i don't understand a very basic detail of how i should go about answering the exercise. here's a simplified example question and example programme to hopefully get at what i'd like to know:
3
1597
by: rollasoc | last post by:
Hi, Anyone know a way of working out the total number and which COM ports exist on a machine, using C#? rollasoc
0
1082
by: rollasoc | last post by:
Hi, Ok, sussed how to find the 2 COM Ports on my motherboard ok, using System.Management namespace and looking for Win32_SerialPort. 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?
2
303
by: rollasoc | last post by:
Hi, I've worked out how to find the 2 COM Ports on my motherboard ok, using System.Management namespace and looking for Win32_SerialPort. 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?
11
4913
by: John | last post by:
Is there a way to find the number of processors on a machine (on linux/ windows/macos/cygwin) using python code (using the same code/cross platform code)?
25
4546
by: Daniel Kraft | last post by:
Hi, I do need to implement something similar to C++'s std::bitset in C; for this, I use an array of int's to get together any desired number of bits, possibly larger than 32/64 or anything like this. So of course it does not matter how many bits a single int has, but I do need a reliable way to find it out. I think of something like
2
1923
by: justinanthonyhamilton | last post by:
Hello, everyone. I recently took a class on Data Structures in C++ (using D.S. Malik's C++ Programming: Program Design Including Data Structures), and while I learned a good about specific data structures, I felt that the class was a little too rushed and sparse for my liking. I passed the class with flying colors, but I think it would be hard for anyone not to do so. I decided to pick up Robert Sedgewick's Algorithms in C++ 3rd edition...
3
3880
by: Akash | last post by:
Hi, I am using getProcessTimes API for calculating CPU Usage On a Multi-Core processor i have observed that the %CPU Usage that is multiple of the number of cores of the processor Is there any API in VC to find the number of Cores of a processor? (PS: Without using WMI ie) url:http://www.ureader.com/gp/1452-1.aspx
1
7208
by: bharathreddy | last post by:
This article will explain how we can get the count of weekdays in between two dates. This will be usefull if we want to count the number of working days between two dates. Example: ------------- USE GO --This function is used to count the number of weekdays between -- two dates. create function udf_Weekdays(@Weekday,@BeginDate datetime,@EndDate datetime) returns integer
0
8611
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
9170
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
8876
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...
0
7741
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6531
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
5867
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
4372
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...
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2341
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.