The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: Magnum on December 10, 2011, 06:52:20 PM

Title: RegisterHotKey help
Post by: Magnum on December 10, 2011, 06:52:20 PM
Since RegisterHotKey requires a two key combination, is there a way to make it work
with just a single Ctrl or Spacebar press ?
Title: Re: RegisterHotKey help
Post by: jj2007 on December 10, 2011, 08:45:06 PM
Sure.
SWITCH uMsg
CASE WM_DESTROY
invoke UnregisterHotKey, 0, 127
invoke PostQuitMessage, NULL

CASE WM_HOTKEY
invoke MessageBox, rv(GetForegroundWindow), chr$("Ho ho HOT"), chr$("Ciao:"), MB_OK

CASE WM_CREATE
invoke RegisterHotKey, hWnd, 127, 0, VK_F2
Title: Re: RegisterHotKey help
Post by: ragdog on December 10, 2011, 08:49:09 PM
Or use keybd_event

http://www.masm32.com/board/index.php?topic=15797.0
Title: Re: RegisterHotKey help
Post by: Magnum on December 10, 2011, 09:44:58 PM
Thanks gentlemen.

This is my final version.

It combines two separate programs into one.  :U