Solved

Fast interapp communication

Posted on 2004-10-20
2
189 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi Spellcheck in Webbrowser 1 76
Print Graphic and Text to Epson TM-T88v 12 547
Unique identifier on a terminal server (rdp) 4 85
Dev express lookupcombo 3 64
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

732 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