clunix
24th July 2002 19:14 UTC
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
24th July 2002 19:53 UTC
Include WinMessages.NSH in your NSIS directory to your script and you will have them all defined.
clunix
24th July 2002 20:52 UTC
Sorry, I don't know what you mean by this.
kichik
24th July 2002 21:02 UTC
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
clunix
24th July 2002 21:26 UTC
Great. THANKS. But what are the wparam and lparam values for? What are they used for?
kichik
24th July 2002 21:32 UTC
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.
clunix
24th July 2002 21:47 UTC
Thanks again and thanks for the fast response.
kichik
24th July 2002 22:00 UTC
Glad I can help :D