From e70a05cabf32e2fe031addfd8ecbe9369d7d1c02 Mon Sep 17 00:00:00 2001 From: Maarten Bosma Date: Mon, 11 Apr 2005 20:27:20 +0000 Subject: [PATCH] Package Manager: fixed HotKeys (thanks to w3seek) *shamed* svn path=/trunk/; revision=14592 --- rosapps/packmgr/gui/generic.rc | 10 ++++++++++ rosapps/packmgr/gui/main.cpp | 13 ++++++------- rosapps/packmgr/gui/main.h | 1 + rosapps/packmgr/gui/resource.h | 1 + 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/rosapps/packmgr/gui/generic.rc b/rosapps/packmgr/gui/generic.rc index 25486492e49..8aaed69da00 100644 --- a/rosapps/packmgr/gui/generic.rc +++ b/rosapps/packmgr/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/rosapps/packmgr/gui/main.cpp b/rosapps/packmgr/gui/main.cpp index eb06779f069..7e33ccae014 100644 --- a/rosapps/packmgr/gui/main.cpp +++ b/rosapps/packmgr/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/rosapps/packmgr/gui/main.h b/rosapps/packmgr/gui/main.h index 93451f91118..0a82ae220a5 100644 --- a/rosapps/packmgr/gui/main.h +++ b/rosapps/packmgr/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/rosapps/packmgr/gui/resource.h b/rosapps/packmgr/gui/resource.h index 90aa5f713cf..b52531ef845 100644 --- a/rosapps/packmgr/gui/resource.h +++ b/rosapps/packmgr/gui/resource.h @@ -12,3 +12,4 @@ #define IDC_STATUS2 0x111 #define IDC_CANCEL 0x112 #define IDC_TSTATUS 0x113 +#define IDR_HOTKEYS 0x114 -- 2.17.1