Solved

COM port useage

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

I use more than 1 computer in my office for various reasons. Multiple keyboards and mice take up more than just extra space, they make working a little more complicated. Using one mouse and keyboard for all of my computers makes life easier. This co…
The article will include the best Data Recovery Tools along with their Features, Capabilities, and their Download Links. Hope you’ll enjoy it and will choose the one as required by you.
Video by: Tony
This video teaches viewers how to export a project from Adobe Premiere Pro and the various file types involved.
Using Adobe Premiere Pro, the viewer will learn how to set up a sequence with proper settings, importing pictures, rendering, and exporting the finished product.

776 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