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
Solved

Fast interapp communication

Posted on 2004-10-20
2
187 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
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: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

860 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