Archive: SendMessage problems


SendMessage problems
Hello!

I have this strange problem.
I use FindWindow to find the program and SendMessage to send it a WM_QUIT message, but it didn't work. WM_CLOSE works fine, but my program minimizes on close message (it is designed so). Simple Delphi code works just like it should.

Here are snippets of my code:

.............
Section ""
FindWindow $R1 "PClass" "Program Name"
SendMessage $R1 18 0 0
SetOutPath "$INSTDIR"
.............
18 is WM_QUIT equal.
Simple MESSAGEBOX shows that FindWindow really found the program handle.

Here is the Delphi code that works:

.............
hwnd := FindWindow('PClass','Program Name');
If Hwnd <> 0 Then PostMessage(hwnd, 18, 0, 0);
.............

Where I do mistake? Does SendMessage really send all messages or some of them? Or is this a bug?

Regards,
Nikolai Tsvetkov


Try sending WM_DESTROY or WM_QUIT.


Doesn't work
Neither WM_QUIT (code 18) nor WM_DESTROY (code 2) works :eek:


Try using DestroyWindow with the use of an extension DLL.


my version....
I have done the job with an external program (my program), finding and killing the process, but this is an embedded fucntion and I just wanted to use it.