tags:

views:

124

answers:

2

Using C winapi, how can you capture receieved data from a commport that is open exclusively by another program.

I know there are programs that do this, but I want to code my own monitoring software for a specific purpose and was wondering how is it done?

+1  A: 

You can do this using API hooking see here: http://www.codeproject.com/KB/system/hooksys.aspx for details. Basically you could load the target process, inject some code into the target process to hook the API that you're interested in and then use an IPC mechanism to transfer the data from your hooks to your analysis program.

This is how my program that can control the values returned by GetTickCount() in another program works (see here http://www.lenholgate.com/archives/000647.html)

Len Holgate
A: 

There is a nice article that describes how to do it by enumerating registry keys here: http://www.codeproject.com/system/listports.asp

I have found this approach to work well on XP and Vista.

Bruce Ikin
This just lists ports, it does nothing with the data...
Remko