Hook.DLL: Using Memory Mapped file for two way communication?


I wrote a simple Hook DLL that communicates to its "creator process" with OpenFileMapping/MapViewOfFile during the DLL_PROCESS_ATTACH.  After hook DLL has written some data to the Memory mapped file, it uses PostMessage no notify the "creator process" that new data is available in memory mapped file.    When Posted Message arrives, creator just reads the input from file.

The communication is currently "one way" only, while I need two way communication.

My question is, what would be a best way to allow "creator process" easily respond true/false back to the Hook DLL (applications).  I checked using SendMessage instead of PostMessage  but it may be too slow..  I need to have a fast method.

 



TommiAsked:
Who is Participating?
 
GranModCommented:
PAQed with points refunded (125)

GranMod
Community Support Moderator
0
 
George TokasCommented:
As I understand you want a communication between applications...
Why making your life miserable and don't use sockets??
Drop a TServerSocket in one app and a TClientSocket to the other.
Select nonBlocking model, Host to "localhost" if they are about to run in the same PC, chose a port and communicate with AnsiStrings using the functions Socket->SendText() and Socket->ReceiveText()...

gtokas.
0
 
TommiAuthor Commented:

I prefer to use only Win32 calls, no any external libraries.


PS:   Sorry, actually this is not CBuilder question,  Its a General C++ question ,  but since there was no win32 or C++ category and I did not want to choose MFC category, I had to place my Q  here:

0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

 
George TokasCommented:
There is a C++ TA...
Check out in the left under programming channels|Languages..
It's the third in a row right under C#...

gtokas.
0
 
TommiAuthor Commented:
is there a way to change the category of this Q
0
 
George TokasCommented:
Use the following link and ask a moderator to change it..
http://www.experts-exchange.com/Community_Support/

gtokas.
0
 
George TokasCommented:
BTW...
Have you considered using a "simple" file instead of all these and check it both apps in a 1sec basis??
Use a byte at the start to declare locked from application and the ID of the application changed it...

gtokas.
0
 
TommiAuthor Commented:
Thanks, but  I will use Mutex  
0
 
TommiAuthor Commented:
Even better, I found the Global Atom Table, its faster option I think so I go for it
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.