- Make the "Exit" string translateable
authorColin Finck <colin@reactos.org>
Sun, 20 Apr 2008 19:49:10 +0000 (19:49 +0000)
committerColin Finck <colin@reactos.org>
Sun, 20 Apr 2008 19:49:10 +0000 (19:49 +0000)
- Use the last possible ID for this command, so we can add as many keyboard layouts as possible to the popup menu
- Send a WM_CLOSE message when clicking "Exit", don't duplicate the WM_DESTROY code here

svn path=/trunk/; revision=33079

reactos/base/applications/kbswitch/kbswitch.c
reactos/base/applications/kbswitch/kbswitch.h
reactos/base/applications/kbswitch/kbswitch.rc
reactos/base/applications/kbswitch/lang/de-DE.rc [new file with mode: 0644]
reactos/base/applications/kbswitch/lang/en-US.rc [new file with mode: 0644]
reactos/base/applications/kbswitch/resource.h
reactos/base/applications/kbswitch/rsrc.rc [new file with mode: 0644]

index 456dd41..dea20f0 100644 (file)
@@ -137,6 +137,7 @@ BuildPopupMenu()
     HMENU hMenu;
     HKEY hKey;
     DWORD dwIndex, dwSize;
+    LPTSTR szExit;
     TCHAR szLayoutNum[CCH_ULONG_DEC + 1];
     TCHAR szName[MAX_PATH];
 
@@ -159,8 +160,9 @@ BuildPopupMenu()
         RegCloseKey(hKey);
     }
 
-    AppendMenu(hMenu, MF_SEPARATOR, 0, _T(""));
-    AppendMenu(hMenu, MF_STRING, 1000, _T("Exit"));
+    LoadString(hInst, IDS_EXIT, (LPTSTR)&szExit, 0);
+    AppendMenu(hMenu, MF_SEPARATOR, 0, NULL);
+    AppendMenu(hMenu, MF_STRING, MENU_ID_EXIT, szExit);
 
     return hMenu;
 }
@@ -194,16 +196,11 @@ WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
             break;
 
         case WM_COMMAND:
-            if (LOWORD(wParam) == 1000)
-            {
-                DestroyMenu(hPopupMenu);
-                DelTrayIcon(hwnd);
-                PostQuitMessage(0);
-            }
+            if (LOWORD(wParam) == MENU_ID_EXIT)
+                SendMessage(hwnd, WM_CLOSE, 0, 0);
             else
-            {
                 ActivateLayout(LOWORD(wParam));
-            }
+
             break;
 
         case WM_DESTROY:
index 1be3801..9630da6 100644 (file)
@@ -9,3 +9,5 @@
 
 // Maximum Character Count of a ULONG in decimal
 #define CCH_ULONG_DEC    10
+
+#define MENU_ID_EXIT     65535
index ca5c22b..8d45e25 100644 (file)
@@ -3,4 +3,11 @@
 
 LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
 
+#define REACTOS_STR_FILE_DESCRIPTION   "ReactOS Keyboard Layout Switcher\0"
+#define REACTOS_STR_INTERNAL_NAME      "kbswitch\0"
+#define REACTOS_STR_ORIGINAL_FILENAME  "kbswitch.exe\0"
+#include <reactos/version.rc>
+
 IDI_MAIN ICON "res/kbswitch.ico"
+
+#include "rsrc.rc"
diff --git a/reactos/base/applications/kbswitch/lang/de-DE.rc b/reactos/base/applications/kbswitch/lang/de-DE.rc
new file mode 100644 (file)
index 0000000..073d73e
--- /dev/null
@@ -0,0 +1,6 @@
+LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL
+
+STRINGTABLE
+BEGIN
+       IDS_EXIT, "Beenden"
+END
diff --git a/reactos/base/applications/kbswitch/lang/en-US.rc b/reactos/base/applications/kbswitch/lang/en-US.rc
new file mode 100644 (file)
index 0000000..cdc895f
--- /dev/null
@@ -0,0 +1,6 @@
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+
+STRINGTABLE
+BEGIN
+       IDS_EXIT, "Exit"
+END
index 4893726..e6976c7 100644 (file)
@@ -1,2 +1,5 @@
 /* Icons */
 #define IDI_MAIN    100
+
+/* Strings */
+#define IDS_EXIT    1001
diff --git a/reactos/base/applications/kbswitch/rsrc.rc b/reactos/base/applications/kbswitch/rsrc.rc
new file mode 100644 (file)
index 0000000..eec9726
--- /dev/null
@@ -0,0 +1,2 @@
+#include "lang/de-DE.rc"
+#include "lang/en-US.rc"