So, I'm trying to make an app in NSIS that will act according to a certain hotkey that's pressed (in this case, alt + b). I think I've got the register/unregister part down, but I don't know how to store whatever was pressed into $var, then I can do what I need to from there...
I've never used the system plugin (or GetDlgItem for that matter), nor have I registered hotkeys, but I found a couple of tutorials on how to use the system plugin (from the manual), and how to register hotkeys (from MSDN).
So far, I got this from guessing and checking:
GetDlgItem $0 $HWNDPARENT 1 MessageBox MB_OK "$0" ; returns random numeber System::Call 'User32::RegisterHotKey(l $0, i 1, t MOD_ALT, t 0x42) i .r2' MessageBox MB_OK "$2" ; returns nonzero (good) (1 for me) ; Store whatever's pressed then do stuff ;(other stuff) ; And then: System::Call 'User32::UnregisterHotKey(l $0, i 1) i .r2' MessageBox MB_OK "$2" ; returns nonzero (good) (1 for me)
I've searched google forever and have still been unsuccessful, so any help would be awesome :D.
You're using NSIS for something that it was never meant for and you're having to do a mighty large lot of bending to get it into shape. And you'll be struggling against it the whole way. My advice is to give it up and use something like Python plus PyQt4/PySide (what I'm using in the Development Toolkit).
I am a Christian and a developer and moderator here.
“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1
NSIS is an installer language, if you've managed to get it to do anything with hotkeys so far I salute you. You may find it a little easier though to use something like AutoHotkey, which was built with ease of use and hotkeys in mind. Let us know what you come up with though, I'd like to see the end result
But there’s no sense crying over every mistake,
You just keep on trying till you run out of cake.
A quick search of the NSIS Discussion Forum found this topic:
http://forums.winamp.com/showthread.php?t=310224
Edit: Another idea is to use the standard nsDialogs plugin and create a hidden control to handle the hotkey. See the nsDialogs FAQ at http://nsis.sourceforge.net/NsDialogs_FAQ
I found a similar NSIS discussion in the winamp forums, which gave me the idea to use the system plugin, but I think the NsDialogs is more appealing to learn.
Thanks!