Re: DLL and communication from another process exe
- From: Joseph M. Newcomer <newcomer@xxxxxxxxxxxx>
- Date: Sun, 23 Sep 2007 02:03:52 -0400
Generally, you should avoid ever doing a FindWIndow as you have done. As soon as your app
moves to a different locale, or you just whimsically decide to change the caption, you're
screwed.
It is risky to do cross-thread SendMessage, but if all you want is a bool, then if you are
willing to live with the risks of SendMessage, the value returned from SendMessage would
be your BOOL.
My own preference is to
::PostMessage(HWND_BROADCASE, UWM_QUERY_WHO_ARE_YOU, (WPARAM)m_hWnd, 0);
where the message shown is a Registered Window Message. All top-level windows receive it,
but only the app that understands it can respond. So what I typically do is send the HWND
of the receiving handle. The receiver would PostMessage a UWM_I_AM_HERE message with its
own HWND, thus establishing the communication channel (this works fine window-to-window).
If I were doing this in a DLL, I might consider creating a UI thread in the DLL that
creates an invisible window that handles the communication.
joe
On Sat, 22 Sep 2007 20:27:44 -0700, "Scott Kraemer" <skraemer8@xxxxxxx> wrote:
Im working this out..I know how to send a message to a exe, and catch it inJoseph M. Newcomer [MVP]
a map...how do I send back a response?
from my DLLthat is running under a seperate exe
HWND hMain;
hMain = ::FindWindow(NULL, "DIALOG CAPTION OF EXE")
SendMessage(hMain .....
EXE gets SendMessage from DLL
I want to return from EXE a bool
should I be looking at call back functions? or is there something easier?
Thanks
"Scott Kraemer" <skraemer8@xxxxxxx> wrote in message
news:OF1eftY$HHA.4324@xxxxxxxxxxxxxxxxxxxxxxx
I want to be able to have my DLL communicate with a seperate process
executable application
basically, I want the running DLL to post a message to the EXE and get a
response from it (simple bool)
Can anyone give me a hint as to what methods I could use to do something
like this?
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.
- References:
- DLL and communication from another process exe
- From: Scott Kraemer
- Re: DLL and communication from another process exe
- From: Scott Kraemer
- DLL and communication from another process exe
- Prev by Date: Re: DLL and communication from another process exe
- Next by Date: Re: #if !defined(AFX_
- Previous by thread: Re: DLL and communication from another process exe
- Index(es):
Relevant Pages
|