Solved

COM port useage

Posted on 2003-10-23
5
197 Views
Last Modified: 2013-11-15
Is there a way to return the program that is using a selected com port.

I want to be able to tell a user which program they need to close to release the com port so my program can then use it.

Thanks

Adrian Wood
0
Comment
Question by:adeshere2
  • 2
5 Comments
 
LVL 17

Accepted Solution

by:
Wim ten Brink earned 63 total points
ID: 9605471
You'd have to find the handle for the open port and then find which application uses this handle. This is some very deep API functionality and I'm not sure if you can access this quite easily...
Or perhaps you have to enumerate all applications, all handles per application and see if the handle is linked to the COM port...
0
 
LVL 8

Assisted Solution

by:gmayo
gmayo earned 62 total points
ID: 9605493
I don't know of any direct way and have never seen a program do that, including MS ones. However, a COM port handle is the same as any other file handle. So if you can go through each process/thread and determine which handles it owns, then maybe you can find out who actually owns it. I don't know if that is possible though.

Geoff M.
0
 
LVL 17

Expert Comment

by:Wim ten Brink
ID: 9605835
About enumerating handles owned by an application, the Handle.exe at http://www.sysinternals.com/ntw2k/freeware/handle.shtml seems to be able to do this. An application HandleEx is also part of the Windows 2000 Resource kit. Unfortunately, no sourcecode available...
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Storage devices are generally used to save the data or sometime transfer the data from one computer system to another system. However, sometimes user accidentally erased their important data from the Storage devices. Users have to know how data reco…
Healthcare organizations in the United States must adhere to the guidance of both the HIPAA (Health Insurance Portability and Accountability Act) and HITECH (Health Information Technology for Economic and Clinical Health Act) for securing and protec…
The viewer will learn how to create multiple layers to apply various filters and how to delete areas from each layer’s filter.
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now