Skip to content
⌘ NSIS Forum Archive

SendMessage problems

5 posts

nocarr#

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
nocarr#
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.