mirror of
https://github.com/reactos/reactos.git
synced 2024-11-20 06:15:26 +00:00
- Add "Preferences" button
svn path=/trunk/; revision=33109
This commit is contained in:
parent
a869e80716
commit
64a5765676
6 changed files with 74 additions and 23 deletions
|
@ -117,8 +117,8 @@ GetLayoutName(LPTSTR szLayoutNum, LPTSTR szName)
|
|||
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 @@ BuildPopupMenu()
|
|||
HMENU hMenu;
|
||||
HKEY hKey;
|
||||
DWORD dwIndex, dwSize;
|
||||
TCHAR szExit[MAX_PATH];
|
||||
TCHAR szLayoutNum[CCH_ULONG_DEC + 1];
|
||||
TCHAR szName[MAX_PATH];
|
||||
|
||||
|
@ -165,13 +164,19 @@ BuildPopupMenu()
|
|||
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
|
||||
WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
|
@ -189,7 +194,6 @@ WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
|
|||
{
|
||||
case WM_LBUTTONDBLCLK:
|
||||
case WM_LBUTTONDOWN:
|
||||
case WM_RBUTTONDOWN:
|
||||
{
|
||||
POINT pt;
|
||||
|
||||
|
@ -197,15 +201,45 @@ WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
|
|||
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:
|
||||
|
|
|
@ -10,5 +10,3 @@
|
|||
|
||||
// Maximum Character Count of a ULONG in decimal
|
||||
#define CCH_ULONG_DEC 10
|
||||
|
||||
#define MENU_ID_EXIT 65535
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue