Author: dchapyshev
Date: Tue Apr 22 15:01:08 2008
New Revision: 33109
URL:
http://svn.reactos.org/svn/reactos?rev=33109&view=rev
Log:
- Add "Preferences" button
Modified:
trunk/reactos/base/applications/kbswitch/kbswitch.c
trunk/reactos/base/applications/kbswitch/kbswitch.h
trunk/reactos/base/applications/kbswitch/lang/de-DE.rc
trunk/reactos/base/applications/kbswitch/lang/en-US.rc
trunk/reactos/base/applications/kbswitch/lang/ru-RU.rc
trunk/reactos/base/applications/kbswitch/resource.h
Modified: trunk/reactos/base/applications/kbswitch/kbswitch.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/kbswitch…
==============================================================================
--- trunk/reactos/base/applications/kbswitch/kbswitch.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/kbswitch/kbswitch.c [iso-8859-1] Tue Apr 22 15:01:08
2008
@@ -117,8 +117,8 @@
BOOL CALLBACK
EnumWindowsProc(HWND hwnd, LPARAM lParam)
{
- SendMessage(hwnd, WM_INPUTLANGCHANGEREQUEST, 0, lParam);
- return TRUE;
+ SendMessage(hwnd, WM_INPUTLANGCHANGEREQUEST, 0, lParam);
+ return TRUE;
}
static VOID
@@ -142,7 +142,6 @@
HMENU hMenu;
HKEY hKey;
DWORD dwIndex, dwSize;
- TCHAR szExit[MAX_PATH];
TCHAR szLayoutNum[CCH_ULONG_DEC + 1];
TCHAR szName[MAX_PATH];
@@ -165,11 +164,17 @@
RegCloseKey(hKey);
}
- LoadString(hInst, IDS_EXIT, szExit, MAX_PATH);
- AppendMenu(hMenu, MF_SEPARATOR, 0, NULL);
- AppendMenu(hMenu, MF_STRING, MENU_ID_EXIT, szExit);
-
return hMenu;
+}
+
+static VOID
+ShowRightPopupMenu(HWND hwnd, POINT pt)
+{
+ HMENU hMenu;
+
+ hMenu = GetSubMenu(LoadMenu(hInst, MAKEINTRESOURCE(IDR_POPUP)), 0);
+ TrackPopupMenu(hMenu, 0, pt.x, pt.y, 0, hwnd, NULL);
+ DestroyMenu(hMenu);
}
LRESULT CALLBACK
@@ -189,7 +194,6 @@
{
case WM_LBUTTONDBLCLK:
case WM_LBUTTONDOWN:
- case WM_RBUTTONDOWN:
{
POINT pt;
@@ -197,15 +201,45 @@
TrackPopupMenu(hPopupMenu, 0, pt.x, pt.y, 0, hwnd, NULL);
}
break;
+ case WM_RBUTTONDOWN:
+ {
+ POINT pt;
+
+ GetCursorPos(&pt);
+ ShowRightPopupMenu(hwnd, pt);
+ }
+ break;
}
break;
case WM_COMMAND:
- if (LOWORD(wParam) == MENU_ID_EXIT)
- SendMessage(hwnd, WM_CLOSE, 0, 0);
- else
- ActivateLayout(LOWORD(wParam));
-
+ switch (LOWORD(wParam))
+ {
+ case ID_EXIT:
+ SendMessage(hwnd, WM_CLOSE, 0, 0);
+ break;
+
+ case ID_PROFERENCES:
+ {
+ SHELLEXECUTEINFO shInputDll;
+
+ memset(&shInputDll, 0x0, sizeof(SHELLEXECUTEINFO));
+ shInputDll.cbSize = sizeof(shInputDll);
+ shInputDll.hwnd = hwnd;
+ shInputDll.lpVerb = _T("open");
+ shInputDll.lpFile = _T("RunDll32.exe");
+ shInputDll.lpParameters = _T("shell32.dll,Control_RunDLL
input.dll");
+ if (ShellExecuteEx(&shInputDll) == 0)
+ {
+ MessageBox(hwnd, _T("Can't start input.dll"), NULL,
MB_OK | MB_ICONERROR);
+ }
+ }
+ break;
+
+ default:
+ ActivateLayout(LOWORD(wParam));
+ break;
+ }
break;
case WM_DESTROY:
Modified: trunk/reactos/base/applications/kbswitch/kbswitch.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/kbswitch…
==============================================================================
--- trunk/reactos/base/applications/kbswitch/kbswitch.h [iso-8859-1] (original)
+++ trunk/reactos/base/applications/kbswitch/kbswitch.h [iso-8859-1] Tue Apr 22 15:01:08
2008
@@ -10,5 +10,3 @@
// Maximum Character Count of a ULONG in decimal
#define CCH_ULONG_DEC 10
-
-#define MENU_ID_EXIT 65535
Modified: trunk/reactos/base/applications/kbswitch/lang/de-DE.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/kbswitch…
==============================================================================
--- trunk/reactos/base/applications/kbswitch/lang/de-DE.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/kbswitch/lang/de-DE.rc [iso-8859-1] Tue Apr 22
15:01:08 2008
@@ -1,6 +1,11 @@
LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL
-STRINGTABLE
+IDR_POPUP MENU
BEGIN
- IDS_EXIT, "Beenden"
+ POPUP "popup"
+ BEGIN
+ MENUITEM "&Preferences...", ID_PROFERENCES
+ MENUITEM SEPARATOR
+ MENUITEM "&Beenden", ID_EXIT
+ END
END
Modified: trunk/reactos/base/applications/kbswitch/lang/en-US.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/kbswitch…
==============================================================================
--- trunk/reactos/base/applications/kbswitch/lang/en-US.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/kbswitch/lang/en-US.rc [iso-8859-1] Tue Apr 22
15:01:08 2008
@@ -1,6 +1,11 @@
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-STRINGTABLE
+IDR_POPUP MENU
BEGIN
- IDS_EXIT, "Exit"
+ POPUP "popup"
+ BEGIN
+ MENUITEM "&Preferences...", ID_PROFERENCES
+ MENUITEM SEPARATOR
+ MENUITEM "&Exit", ID_EXIT
+ END
END
Modified: trunk/reactos/base/applications/kbswitch/lang/ru-RU.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/kbswitch…
==============================================================================
--- trunk/reactos/base/applications/kbswitch/lang/ru-RU.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/kbswitch/lang/ru-RU.rc [iso-8859-1] Tue Apr 22
15:01:08 2008
@@ -1,6 +1,11 @@
LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
-STRINGTABLE
+IDR_POPUP MENU
BEGIN
- IDS_EXIT, "Âûõîä"
+ POPUP "popup"
+ BEGIN
+ MENUITEM "&Ïàðàìåòðû...", ID_PROFERENCES
+ MENUITEM SEPARATOR
+ MENUITEM "&Âûõîä", ID_EXIT
+ END
END
Modified: trunk/reactos/base/applications/kbswitch/resource.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/kbswitch…
==============================================================================
--- trunk/reactos/base/applications/kbswitch/resource.h [iso-8859-1] (original)
+++ trunk/reactos/base/applications/kbswitch/resource.h [iso-8859-1] Tue Apr 22 15:01:08
2008
@@ -1,5 +1,9 @@
/* Icons */
-#define IDI_MAIN 100
+#define IDI_MAIN 100
-/* Strings */
-#define IDS_EXIT 1001
+/* Menus */
+#define IDR_POPUP 12000
+
+/* Menu items */
+#define ID_EXIT 10001
+#define ID_PROFERENCES 10002