- Make the "Exit" string translateable

- 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
This commit is contained in:
Colin Finck 2008-04-20 19:49:10 +00:00
parent ae6a3c787b
commit af30d3067b
7 changed files with 33 additions and 10 deletions

View 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:

View file

@ -9,3 +9,5 @@
// Maximum Character Count of a ULONG in decimal
#define CCH_ULONG_DEC 10
#define MENU_ID_EXIT 65535

View 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"

View file

@ -0,0 +1,6 @@
LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL
STRINGTABLE
BEGIN
IDS_EXIT, "Beenden"
END

View file

@ -0,0 +1,6 @@
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
STRINGTABLE
BEGIN
IDS_EXIT, "Exit"
END

View file

@ -1,2 +1,5 @@
/* Icons */
#define IDI_MAIN 100
/* Strings */
#define IDS_EXIT 1001

View file

@ -0,0 +1,2 @@
#include "lang/de-DE.rc"
#include "lang/en-US.rc"