See
RegisterWindowMessage() for information on getting a message ID your application can use to talk to other instances of itself or other applications:
http://www.google.com/search?btnI=1&q=msdn+RegisterWindowMessage
The message itself is a
MSG structure:
http://www.google.com/search?btnI=1&q=msdn+MSG
The items of interest are
wParam and
lParam -- these are how you can send codes to each other. There is also a
pt member that you can co-opt (it is used in mouse messages and the like).
What I would do, actually, is just broadcast your unique message ID (obtained via
RegisterWindowMessage()) every time one of your windows is moved or mapped, with a wParam indicating that the application is looking for communication and an lParam with the originator's HWND.
Also, listen for the same message ID in your application. Once the message is received, it can check to see if touching using
GetWindowRect() on the two windows and comparing the results.
http://www.google.com/search?btnI=1&q=msdn+GetWindowRect
If the windows are satisfiably aligned then the listener can send back that it wants to talk with a different code in wParam.
To actually send strings (or other things) between applications, you can use the
WM_COPYDATA message. See the following articles:
Inter Process Communication via WM_COPYDATA
http://www.codeguru.com/cpp/w-p/system/processesmodules/article.php/c5777
TechBlog - IPC with WM_COPYDATA
http://blog.hansentech.com/mhblog_2008_11_19.html
To use this method, your application will need to create a hidden window with a proper window procedure attached.
Well, that should be enough to get you started. Good luck!