Re: DLL and communication from another process exe



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 in
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?

Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.



Relevant Pages

  • Re: recognize .Net controls properly and get infos/styles/properties
    ... and convert and compile the source in VS 2005 ... Since the error is not stopping the generation of the .exe and .dll I ... have both .net 1.0 and 2.0 window listed in the treeview. ...
    (microsoft.public.vc.language)
  • Re: Dyn loaded files and owner status window
    ... Grab the handle of the window from its name (or pass it to the dll from the ... He suggests another dll with events - eminently logical. ... >> I have a main exe program that have a status window. ... >> This exe program loads several dll files with Assembly.LoadFile. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Why does AfxGetMainWnd returns nulls?
    ... Its the main exe that is poping up the parent window, ... The child window will be called from my dll. ... I have been using MFC regular dll and not the extension dll. ...
    (microsoft.public.vc.mfc)
  • Re: Parent and Child in separate UI Threads
    ... and the correct fix is NOT to put the window in a separate thread! ... DLL contains business logic, some MFC windows and some dialogs. ... EXE collaborates with DLL via interface described by IDL. ...
    (microsoft.public.vc.mfc)
  • Re: Can I not OpenProcess(PROCESS_ALL_ACCESS...) in DLL under WinXP?
    ... thing was done in dll and exe. ... bool __stdcall _FindApp(wstring sClass, wstring sImage, ...
    (microsoft.public.vc.mfc)