views:

299

answers:

2

I've been able to set local hotkeys like this

 RegisterHotKey(hwndDlg, 100, MOD_ALT | MOD_CONTROL, 'S');

how can I set the hotkey to be global?( I want it to be there even when my window is hidden)

A: 

It desn't matter if your window is visible or not. You should not use a hWnd you plan to destory (like a dialog). Create a separate (invisible) window if you have no other suitable window.

danbystrom
I don't destroy it I just hide it like thisShowWindow(hwndDlg, SW_HIDE);
mars
A: 

I solved it myself but thanks for your reply here's what was wrong...

ShowWindow(hwndDlg, SW_HIDE);
RegisterHotKey(hwndDlg, 100, MOD_ALT | MOD_CONTROL, 'S');

if you register the hotkey first then hide the window... it ignores the hotkey for some reason... oh well.. it's working now :)

mars