Skip to content
⌘ NSIS Forum Archive

SendMessage Usage

8 posts

clunix#

SendMessage Usage

Where can I find all the available messages and their values? What are wparam and lparam? I found examples in the Winamp forum but I don't know what the different wparam and lparam values will do. How would I close a window once I have the HWND from FindWindow? SendMessage $R9 16 ? ?

From the docs:
SendMessage HWND
msg
wparam
lparam
[user_var(return value)]

... Here are a few example messages and their values:

* WM_CLOSE 16
* WM_COMMAND 273
* WM_USER 1024
kichik#
Include WinMessages.NSH in your NSIS directory to your script and you will have them all defined.
kichik#
Add this line:
!include "C:\Program Files\NSIS\WinMessages.nsh"
At the top of your script.

If you use NSIS 2.0a1 put this line:
!include "C:\Program Files\NSIS\Examples\WinMessages.nsh"

Then you will be able to use any windows message by its name.

Example:

FindWindow $0 "Winamp v1.x"
SendMessage $0 ${WM_CLOSE} 0 0
kichik#
Every messages deals with its WPARAM and LPARAM differently. They are just two parameters for every message, like functions in C.

WM_CLOSE ignores them, so you can leave them both at 0.

For more information on every message and its parameters go to MSDN and search for the message name.