diff --git a/gui/generic.rc b/gui/generic.rc index 2548649..8aaed69 100644 --- a/gui/generic.rc +++ b/gui/generic.rc @@ -22,3 +22,13 @@ IDB_TOOLBAR BITMAP DISCARDABLE "res/toolbar.bmp" 13 ICON DISCARDABLE "res/update.ico" 14 ICON DISCARDABLE "res/uninstall.ico" +/* HotKeys */ + +IDR_HOTKEYS ACCELERATORS DISCARDABLE +BEGIN + "1", 2, VIRTKEY, CONTROL + "2", 3, VIRTKEY, CONTROL + "3", 4, VIRTKEY, CONTROL + "4", 5, VIRTKEY, CONTROL + "0", 1, VIRTKEY, CONTROL +END diff --git a/gui/main.cpp b/gui/main.cpp index eb06779..7e33cca 100644 --- a/gui/main.cpp +++ b/gui/main.cpp @@ -67,8 +67,11 @@ int WINAPI WinMain (HINSTANCE hinst, HINSTANCE hPrevInstance, PSTR szCmdLine, in // Start getting messages while(GetMessage(&msg,NULL,0,0)) { - TranslateMessage(&msg); - DispatchMessage(&msg); + if(!TranslateAccelerator(hwnd, hHotKeys, &msg)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } } // Close our handle @@ -152,11 +155,7 @@ void InitControls (HWND hwnd) ImageList_AddIcon(hIcon, LoadIcon(hinst, MAKEINTRESOURCE(10))); // Setup Hotkeys - RegisterHotKey(hwnd, 1, MOD_CONTROL, VK_1); - RegisterHotKey(hwnd, 2, MOD_CONTROL, VK_2); - RegisterHotKey(hwnd, 3, MOD_CONTROL, VK_3); - RegisterHotKey(hwnd, 4, MOD_CONTROL, VK_4); - RegisterHotKey(hwnd, 0, MOD_CONTROL, VK_0); + hHotKeys = LoadAccelerators (hinst, MAKEINTRESOURCE(IDR_HOTKEYS)); } // Set the Icons diff --git a/gui/main.h b/gui/main.h index 93451f9..0a82ae2 100644 --- a/gui/main.h +++ b/gui/main.h @@ -19,6 +19,7 @@ int selected, splitter_pos = 50; pTree tree; HMENU hPopup; +HACCEL hHotKeys; HWND hTBar, hTree, hEdit, hStatus; HTREEITEM nodes [MAXNODES]; diff --git a/gui/resource.h b/gui/resource.h index 90aa5f7..b52531e 100644 --- a/gui/resource.h +++ b/gui/resource.h @@ -12,3 +12,4 @@ #define IDC_STATUS2 0x111 #define IDC_CANCEL 0x112 #define IDC_TSTATUS 0x113 +#define IDR_HOTKEYS 0x114