Old 9th December 2019, 11:41   #1
caseys
Junior Member
 
Join Date: Dec 2019
Posts: 3
get keypress

hello,

how can i get the state of the key pressed using GetKeyboardState?
i mean if i press the "W" button on keyboard, to get MessageBox

thank you
caseys is offline   Reply With Quote
Old 9th December 2019, 12:48   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,287
Globally or only when your installer has focus?

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 9th December 2019, 16:44   #3
caseys
Junior Member
 
Join Date: Dec 2019
Posts: 3
globaly
caseys is offline   Reply With Quote
Old 10th December 2019, 03:20   #4
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,287
Global keyboard handling requires a hook and NSIS is not the correct tool to use, try AutoHotkey or similar tools.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 10th December 2019, 07:38   #5
caseys
Junior Member
 
Join Date: Dec 2019
Posts: 3
otherwise, when it has a focus, how to do that?
caseys is offline   Reply With Quote
Old 10th December 2019, 13:29   #6
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,287
In Windows, keyboard input is sent to a specific window and to handle it in another fashion means using some type of hook.

If we are talking about custom pages and if Alt+W would be acceptable then you can simply create a 0x0 size button with the text "&W" and handle its onClick.

The WndSubclass plug-in can be used to eavesdrop on keyboard messages sent to a specific window in the installer but the plug-in is difficult to use for beginners.


A "any window" type handler requires a hook and you would have to write your own custom plug-in to pull it off.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump