Solved

Fast interapp communication

Posted on 2004-10-20
2
190 Views
Last Modified: 2010-08-05
For somewhat arcane reasons, I need to monitor (globally) keystrokes and mouse movements and later analyze that data.

OK, I can do system wide hooks (ordinary or low level) and accumulate the data in the hookprocs.

But I need to send that data, periodically, to a separate analysis app running in the system tray. This has to be done fast because of the performance implications for the system as a whole. I was thinking WM_COPYDATA but the SDK says to use SendMessage .. I would rather use PostMessage (can I do this??)

Now, maybe I am getting confused here, but is there any reason I cannot grab some memory in the hookproc with GlobalAlloc send its address to the analysis app and free it there?

The data to be transferred is maybe 5K bytes max, if that makes a difference
0
Comment
Question by:Mutley2003
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 17

Accepted Solution

by:
Wim ten Brink earned 500 total points
ID: 12355877
Use a memory mapped file, that is shared between the keylogger and the analyzer. The keylogger writes and the analyzer just reads. Two 64-bits integers (read/write pointer) at the beginning of the MMF should indicate the current position that they are reading and the rest of the MMF is to store the data in a round-robin style. (Thus, when you get past the end of the file, you start at the beginning again.)
A MMF doesn't have to be a physical file even. It can just be a reserved part of memory that is shared between applications. All you have to remember is that you should never read or write beyong the filesize. Also, never write beyond the read-pointer and never read beyond the write pointer. If the read-pointer is 0 then the write pointer knows there's no reader and thus it might not even need to write anything...

MMF's can be reasonable big in size, so a size of 5 to 10 MB is quite well possible.
0
 

Author Comment

by:Mutley2003
ID: 12356062
ok, cool
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

696 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