Reference/SendMessage: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
(Created page with "=SendMessage= HWND msg wparam lparam [user_var(return value)] [/TIMEOUT=time_in_ms] Sends a message to HWND. If a user variable $x is specified as the last parameter (or one b...") |
No edit summary |
||
| Line 5: | Line 5: | ||
Sends a message to HWND. If a user variable $x is specified as the last parameter (or one before the last if you use /TIMEOUT), the return value of SendMessage will be stored to it. Note that when specifying 'msg' you must just use the integer value of the message. If you wish to send strings use "STR:a string" as wParam or lParam where needed. | Sends a message to HWND. If a user variable $x is specified as the last parameter (or one before the last if you use /TIMEOUT), the return value of SendMessage will be stored to it. Note that when specifying 'msg' you must just use the integer value of the message. If you wish to send strings use "STR:a string" as wParam or lParam where needed. | ||
WM_CLOSE 16 | |||
WM_COMMAND 273 | WM_COMMAND 273 | ||
WM_USER 1024 | WM_USER 1024 | ||
Include WinMessages.nsh to have all of Windows messages defined in your script. | Include WinMessages.nsh to have all of Windows messages defined in your script. | ||
| Line 14: | Line 15: | ||
Use /TIMEOUT=time_in_ms to specify the duration, in milliseconds, of the time-out period. | Use /TIMEOUT=time_in_ms to specify the duration, in milliseconds, of the time-out period. | ||
<highlight-nsis>!include WinMessages.nsh | |||
FindWindow $0 "Winamp v1.x" | FindWindow $0 "Winamp v1.x" | ||
SendMessage $0 ${WM_CLOSE} 0 0</highlight-nsis> | SendMessage $0 ${WM_CLOSE} 0 0</highlight-nsis> | ||
Revision as of 22:23, 18 December 2011
SendMessage
HWND msg wparam lparam [user_var(return value)] [/TIMEOUT=time_in_ms]
Sends a message to HWND. If a user variable $x is specified as the last parameter (or one before the last if you use /TIMEOUT), the return value of SendMessage will be stored to it. Note that when specifying 'msg' you must just use the integer value of the message. If you wish to send strings use "STR:a string" as wParam or lParam where needed.
WM_CLOSE 16 WM_COMMAND 273 WM_USER 1024
Include WinMessages.nsh to have all of Windows messages defined in your script.
To send a string param, put STR: before the parameter, for example: "STR:Some string".
Use /TIMEOUT=time_in_ms to specify the duration, in milliseconds, of the time-out period.
!include WinMessages.nsh FindWindow $0 "Winamp v1.x" SendMessage $0 ${WM_CLOSE} 0 0