473,748 Members | 9,913 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 1471
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
1915
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
1599
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
1085
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
4920
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
4548
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
1926
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
3883
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
7210
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
8826
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
9534
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
9366
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...
1
9316
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9241
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
8239
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...
0
4597
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...
2
2777
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2211
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.