Solved

COM port useage

Posted on 2003-10-23
5
198 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If your app took Google’s lash recently, here are the 5 most likely reasons.
All of the resources available today make learning a new digital media easier than ever-- if you know where to begin. This is a clear, simple guide to a few of the basic digital art mediums and how to begin learning them on your own.
The viewer will learn common shortcuts with easy ways to remember them. The viewer will then learn where to find all of the keyboard shortcuts, how to create/change them, and how to speed up their workflow.
An overview on how to enroll an hourly employee into the employee database and how to give them access into the clock in terminal.

911 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

25 Experts available now in Live!

Get 1:1 Help Now