Solved

COM port useage

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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

Suggested Solutions

This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
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 how to create multiple layers to apply various filters and how to delete areas from each layer’s filter.
An overview on how to enroll an hourly employee into the employee database and how to give them access into the clock in terminal.

828 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