[EVENTVWR] Add a context menu to TreeView items. (#3828)

Same as in Windows XP/2003.
+ Specify a default extension when opening or saving an event-log file.
This commit is contained in:
Jose Carlos Jesus 2021-07-17 18:26:48 +01:00 committed by GitHub
parent 4cae349811
commit e4bfe8f78b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 343 additions and 3 deletions

View file

@ -3271,7 +3271,7 @@ InitInstance(HINSTANCE hInstance)
sfn.lpstrFilter = szSaveFilter;
sfn.lpstrInitialDir = NULL;
sfn.Flags = OFN_EXPLORER | OFN_HIDEREADONLY | OFN_SHAREAWARE;
sfn.lpstrDefExt = NULL;
sfn.lpstrDefExt = L"evt";
ShowWindow(hwndMainWindow, Settings.wpPos.showCmd);
UpdateWindow(hwndMainWindow);
@ -3673,11 +3673,38 @@ WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
case WM_INITMENUPOPUP:
lParam = lParam;
break;
#endif
case WM_CONTEXTMENU:
lParam = lParam;
{
RECT rc;
HTREEITEM hItem;
TVHITTESTINFO hInfo = {0};
INT xPos = GET_X_LPARAM(lParam);
INT yPos = GET_Y_LPARAM(lParam);
GetWindowRect(hwndTreeView, &rc);
hInfo.pt.x = xPos - rc.left;
hInfo.pt.y = yPos - rc.top;
hItem = TreeView_HitTest(hwndTreeView, &hInfo);
if (hItem)
{
TreeView_SelectItem(hwndTreeView, hItem);
if (TreeView_GetParent(hwndTreeView, hItem))
{
HMENU hCtxMenu = GetSubMenu(LoadMenuW(hInst, MAKEINTRESOURCEW(IDM_EVENTWR_CTX)), 0);
DWORD dwCmdID = TrackPopupMenuEx(hCtxMenu,
TPM_LEFTALIGN | TPM_TOPALIGN | TPM_NONOTIFY | TPM_RETURNCMD,
xPos, yPos, hWnd, NULL);
SendMessageW(hWnd, WM_COMMAND, (WPARAM)dwCmdID, (LPARAM)hwndTreeView);
}
}
break;
#endif
}
case WM_SETCURSOR:
{

View file

@ -38,6 +38,19 @@ BEGIN
END
END
IDM_EVENTWR_CTX MENU
BEGIN
POPUP ""
BEGIN
MENUITEM "&Open Event Log...", IDM_OPEN_EVENTLOG
MENUITEM "&Save Event Log as...", IDM_SAVE_EVENTLOG
MENUITEM SEPARATOR
MENUITEM "&Clear all Events", IDM_CLEAR_EVENTS
MENUITEM "&Rename\tF2", IDM_RENAME_EVENTLOG
MENUITEM "Log Se&ttings...", IDM_EVENTLOG_SETTINGS
END
END
IDA_EVENTVWR ACCELERATORS
BEGIN
"?", IDM_ABOUT, ASCII, ALT

View file

@ -38,6 +38,19 @@ BEGIN
END
END
IDM_EVENTWR_CTX MENU
BEGIN
POPUP ""
BEGIN
MENUITEM "&Open Event Log...", IDM_OPEN_EVENTLOG
MENUITEM "&Save Event Log as...", IDM_SAVE_EVENTLOG
MENUITEM SEPARATOR
MENUITEM "&Clear all Events", IDM_CLEAR_EVENTS
MENUITEM "&Rename\tF2", IDM_RENAME_EVENTLOG
MENUITEM "Log Se&ttings...", IDM_EVENTLOG_SETTINGS
END
END
IDA_EVENTVWR ACCELERATORS
BEGIN
"?", IDM_ABOUT, ASCII, ALT

View file

@ -40,6 +40,19 @@ BEGIN
END
END
IDM_EVENTWR_CTX MENU
BEGIN
POPUP ""
BEGIN
MENUITEM "&Open Event Log...", IDM_OPEN_EVENTLOG
MENUITEM "&Save Event Log as...", IDM_SAVE_EVENTLOG
MENUITEM SEPARATOR
MENUITEM "&Clear all Events", IDM_CLEAR_EVENTS
MENUITEM "&Rename\tF2", IDM_RENAME_EVENTLOG
MENUITEM "Log Se&ttings...", IDM_EVENTLOG_SETTINGS
END
END
IDA_EVENTVWR ACCELERATORS
BEGIN
"?", IDM_ABOUT, ASCII, ALT

View file

@ -40,6 +40,19 @@ BEGIN
END
END
IDM_EVENTWR_CTX MENU
BEGIN
POPUP ""
BEGIN
MENUITEM "&Open Event Log...", IDM_OPEN_EVENTLOG
MENUITEM "&Save Event Log as...", IDM_SAVE_EVENTLOG
MENUITEM SEPARATOR
MENUITEM "&Clear all Events", IDM_CLEAR_EVENTS
MENUITEM "&Rename\tF2", IDM_RENAME_EVENTLOG
MENUITEM "Log Se&ttings...", IDM_EVENTLOG_SETTINGS
END
END
IDA_EVENTVWR ACCELERATORS
BEGIN
"?", IDM_ABOUT, ASCII, ALT

View file

@ -46,6 +46,19 @@ BEGIN
END
END
IDM_EVENTWR_CTX MENU
BEGIN
POPUP ""
BEGIN
MENUITEM "&Open Event Log...", IDM_OPEN_EVENTLOG
MENUITEM "&Save Event Log as...", IDM_SAVE_EVENTLOG
MENUITEM SEPARATOR
MENUITEM "&Clear all Events", IDM_CLEAR_EVENTS
MENUITEM "&Rename\tF2", IDM_RENAME_EVENTLOG
MENUITEM "Log Se&ttings...", IDM_EVENTLOG_SETTINGS
END
END
IDA_EVENTVWR ACCELERATORS
BEGIN
"?", IDM_ABOUT, ASCII, ALT

View file

@ -40,6 +40,19 @@ BEGIN
END
END
IDM_EVENTWR_CTX MENU
BEGIN
POPUP ""
BEGIN
MENUITEM "&Open Event Log...", IDM_OPEN_EVENTLOG
MENUITEM "&Save Event Log as...", IDM_SAVE_EVENTLOG
MENUITEM SEPARATOR
MENUITEM "&Clear all Events", IDM_CLEAR_EVENTS
MENUITEM "&Rename\tF2", IDM_RENAME_EVENTLOG
MENUITEM "Log Se&ttings...", IDM_EVENTLOG_SETTINGS
END
END
IDA_EVENTVWR ACCELERATORS
BEGIN
"?", IDM_ABOUT, ASCII, ALT

View file

@ -40,6 +40,19 @@ BEGIN
END
END
IDM_EVENTWR_CTX MENU
BEGIN
POPUP ""
BEGIN
MENUITEM "&Open Event Log...", IDM_OPEN_EVENTLOG
MENUITEM "&Save Event Log as...", IDM_SAVE_EVENTLOG
MENUITEM SEPARATOR
MENUITEM "&Clear all Events", IDM_CLEAR_EVENTS
MENUITEM "&Rename\tF2", IDM_RENAME_EVENTLOG
MENUITEM "Log Se&ttings...", IDM_EVENTLOG_SETTINGS
END
END
IDA_EVENTVWR ACCELERATORS
BEGIN
"?", IDM_ABOUT, ASCII, ALT

View file

@ -40,6 +40,19 @@ BEGIN
END
END
IDM_EVENTWR_CTX MENU
BEGIN
POPUP ""
BEGIN
MENUITEM "&Open Event Log...", IDM_OPEN_EVENTLOG
MENUITEM "&Save Event Log as...", IDM_SAVE_EVENTLOG
MENUITEM SEPARATOR
MENUITEM "&Clear all Events", IDM_CLEAR_EVENTS
MENUITEM "&Rename\tF2", IDM_RENAME_EVENTLOG
MENUITEM "Log Se&ttings...", IDM_EVENTLOG_SETTINGS
END
END
IDA_EVENTVWR ACCELERATORS
BEGIN
"?", IDM_ABOUT, ASCII, ALT

View file

@ -40,6 +40,19 @@ BEGIN
END
END
IDM_EVENTWR_CTX MENU
BEGIN
POPUP ""
BEGIN
MENUITEM "&Open Event Log...", IDM_OPEN_EVENTLOG
MENUITEM "&Save Event Log as...", IDM_SAVE_EVENTLOG
MENUITEM SEPARATOR
MENUITEM "&Clear all Events", IDM_CLEAR_EVENTS
MENUITEM "&Rename\tF2", IDM_RENAME_EVENTLOG
MENUITEM "Log Se&ttings...", IDM_EVENTLOG_SETTINGS
END
END
IDA_EVENTVWR ACCELERATORS
BEGIN
"?", IDM_ABOUT, ASCII, ALT

View file

@ -40,6 +40,19 @@ BEGIN
END
END
IDM_EVENTWR_CTX MENU
BEGIN
POPUP ""
BEGIN
MENUITEM "&Open Event Log...", IDM_OPEN_EVENTLOG
MENUITEM "&Save Event Log as...", IDM_SAVE_EVENTLOG
MENUITEM SEPARATOR
MENUITEM "&Clear all Events", IDM_CLEAR_EVENTS
MENUITEM "&Rename\tF2", IDM_RENAME_EVENTLOG
MENUITEM "Log Se&ttings...", IDM_EVENTLOG_SETTINGS
END
END
IDA_EVENTVWR ACCELERATORS
BEGIN
"?", IDM_ABOUT, ASCII, ALT

View file

@ -40,6 +40,19 @@ BEGIN
END
END
IDM_EVENTWR_CTX MENU
BEGIN
POPUP ""
BEGIN
MENUITEM "&Open Event Log...", IDM_OPEN_EVENTLOG
MENUITEM "&Save Event Log as...", IDM_SAVE_EVENTLOG
MENUITEM SEPARATOR
MENUITEM "&Clear all Events", IDM_CLEAR_EVENTS
MENUITEM "&Rename\tF2", IDM_RENAME_EVENTLOG
MENUITEM "Log Se&ttings...", IDM_EVENTLOG_SETTINGS
END
END
IDA_EVENTVWR ACCELERATORS
BEGIN
"?", IDM_ABOUT, ASCII, ALT

View file

@ -38,6 +38,19 @@ BEGIN
END
END
IDM_EVENTWR_CTX MENU
BEGIN
POPUP ""
BEGIN
MENUITEM "&Open Event Log...", IDM_OPEN_EVENTLOG
MENUITEM "&Save Event Log as...", IDM_SAVE_EVENTLOG
MENUITEM SEPARATOR
MENUITEM "&Clear all Events", IDM_CLEAR_EVENTS
MENUITEM "&Rename\tF2", IDM_RENAME_EVENTLOG
MENUITEM "Log Se&ttings...", IDM_EVENTLOG_SETTINGS
END
END
IDA_EVENTVWR ACCELERATORS
BEGIN
"?", IDM_ABOUT, ASCII, ALT

View file

@ -42,6 +42,19 @@ BEGIN
END
END
IDM_EVENTWR_CTX MENU
BEGIN
POPUP ""
BEGIN
MENUITEM "&Open Event Log...", IDM_OPEN_EVENTLOG
MENUITEM "&Save Event Log as...", IDM_SAVE_EVENTLOG
MENUITEM SEPARATOR
MENUITEM "&Clear all Events", IDM_CLEAR_EVENTS
MENUITEM "&Rename\tF2", IDM_RENAME_EVENTLOG
MENUITEM "Log Se&ttings...", IDM_EVENTLOG_SETTINGS
END
END
IDA_EVENTVWR ACCELERATORS
BEGIN
"?", IDM_ABOUT, ASCII, ALT

View file

@ -40,6 +40,19 @@ BEGIN
END
END
IDM_EVENTWR_CTX MENU
BEGIN
POPUP ""
BEGIN
MENUITEM "&Open Event Log...", IDM_OPEN_EVENTLOG
MENUITEM "&Save Event Log as...", IDM_SAVE_EVENTLOG
MENUITEM SEPARATOR
MENUITEM "&Clear all Events", IDM_CLEAR_EVENTS
MENUITEM "&Rename\tF2", IDM_RENAME_EVENTLOG
MENUITEM "Log Se&ttings...", IDM_EVENTLOG_SETTINGS
END
END
IDA_EVENTVWR ACCELERATORS
BEGIN
"?", IDM_ABOUT, ASCII, ALT

View file

@ -40,6 +40,19 @@ BEGIN
END
END
IDM_EVENTWR_CTX MENU
BEGIN
POPUP ""
BEGIN
MENUITEM "&Abrir o ficheiro de registo...", IDM_OPEN_EVENTLOG
MENUITEM "&Guardar ficheiro de registo como...", IDM_SAVE_EVENTLOG
MENUITEM SEPARATOR
MENUITEM "&Limpar todos os Eventos", IDM_CLEAR_EVENTS
MENUITEM "&Alterar o nome\tF2", IDM_RENAME_EVENTLOG
MENUITEM "&Definições...", IDM_EVENTLOG_SETTINGS
END
END
IDA_EVENTVWR ACCELERATORS
BEGIN
"?", IDM_ABOUT, ASCII, ALT

View file

@ -43,6 +43,19 @@ BEGIN
END
END
IDM_EVENTWR_CTX MENU
BEGIN
POPUP ""
BEGIN
MENUITEM "&Open Event Log...", IDM_OPEN_EVENTLOG
MENUITEM "&Save Event Log as...", IDM_SAVE_EVENTLOG
MENUITEM SEPARATOR
MENUITEM "&Clear all Events", IDM_CLEAR_EVENTS
MENUITEM "&Rename\tF2", IDM_RENAME_EVENTLOG
MENUITEM "Log Se&ttings...", IDM_EVENTLOG_SETTINGS
END
END
IDA_EVENTVWR ACCELERATORS
BEGIN
"?", IDM_ABOUT, ASCII, ALT

View file

@ -40,6 +40,19 @@ BEGIN
END
END
IDM_EVENTWR_CTX MENU
BEGIN
POPUP ""
BEGIN
MENUITEM "&Open Event Log...", IDM_OPEN_EVENTLOG
MENUITEM "&Save Event Log as...", IDM_SAVE_EVENTLOG
MENUITEM SEPARATOR
MENUITEM "&Clear all Events", IDM_CLEAR_EVENTS
MENUITEM "&Rename\tF2", IDM_RENAME_EVENTLOG
MENUITEM "Log Se&ttings...", IDM_EVENTLOG_SETTINGS
END
END
IDA_EVENTVWR ACCELERATORS
BEGIN
"?", IDM_ABOUT, ASCII, ALT

View file

@ -43,6 +43,19 @@ BEGIN
END
END
IDM_EVENTWR_CTX MENU
BEGIN
POPUP ""
BEGIN
MENUITEM "&Open Event Log...", IDM_OPEN_EVENTLOG
MENUITEM "&Save Event Log as...", IDM_SAVE_EVENTLOG
MENUITEM SEPARATOR
MENUITEM "&Clear all Events", IDM_CLEAR_EVENTS
MENUITEM "&Rename\tF2", IDM_RENAME_EVENTLOG
MENUITEM "Log Se&ttings...", IDM_EVENTLOG_SETTINGS
END
END
IDA_EVENTVWR ACCELERATORS
BEGIN
"?", IDM_ABOUT, ASCII, ALT

View file

@ -46,6 +46,19 @@ BEGIN
END
END
IDM_EVENTWR_CTX MENU
BEGIN
POPUP ""
BEGIN
MENUITEM "&Open Event Log...", IDM_OPEN_EVENTLOG
MENUITEM "&Save Event Log as...", IDM_SAVE_EVENTLOG
MENUITEM SEPARATOR
MENUITEM "&Clear all Events", IDM_CLEAR_EVENTS
MENUITEM "&Rename\tF2", IDM_RENAME_EVENTLOG
MENUITEM "Log Se&ttings...", IDM_EVENTLOG_SETTINGS
END
END
IDA_EVENTVWR ACCELERATORS
BEGIN
"?", IDM_ABOUT, ASCII, ALT

View file

@ -40,6 +40,19 @@ BEGIN
END
END
IDM_EVENTWR_CTX MENU
BEGIN
POPUP ""
BEGIN
MENUITEM "&Open Event Log...", IDM_OPEN_EVENTLOG
MENUITEM "&Save Event Log as...", IDM_SAVE_EVENTLOG
MENUITEM SEPARATOR
MENUITEM "&Clear all Events", IDM_CLEAR_EVENTS
MENUITEM "&Rename\tF2", IDM_RENAME_EVENTLOG
MENUITEM "Log Se&ttings...", IDM_EVENTLOG_SETTINGS
END
END
IDA_EVENTVWR ACCELERATORS
BEGIN
"?", IDM_ABOUT, ASCII, ALT

View file

@ -46,6 +46,19 @@ BEGIN
END
END
IDM_EVENTWR_CTX MENU
BEGIN
POPUP ""
BEGIN
MENUITEM "&Open Event Log...", IDM_OPEN_EVENTLOG
MENUITEM "&Save Event Log as...", IDM_SAVE_EVENTLOG
MENUITEM SEPARATOR
MENUITEM "&Clear all Events", IDM_CLEAR_EVENTS
MENUITEM "&Rename\tF2", IDM_RENAME_EVENTLOG
MENUITEM "Log Se&ttings...", IDM_EVENTLOG_SETTINGS
END
END
IDA_EVENTVWR ACCELERATORS
BEGIN
"?", IDM_ABOUT, ASCII, ALT

View file

@ -40,6 +40,19 @@ BEGIN
END
END
IDM_EVENTWR_CTX MENU
BEGIN
POPUP ""
BEGIN
MENUITEM "&Open Event Log...", IDM_OPEN_EVENTLOG
MENUITEM "&Save Event Log as...", IDM_SAVE_EVENTLOG
MENUITEM SEPARATOR
MENUITEM "&Clear all Events", IDM_CLEAR_EVENTS
MENUITEM "&Rename\tF2", IDM_RENAME_EVENTLOG
MENUITEM "Log Se&ttings...", IDM_EVENTLOG_SETTINGS
END
END
IDA_EVENTVWR ACCELERATORS
BEGIN
"?", IDM_ABOUT, ASCII, ALT

View file

@ -40,6 +40,19 @@ BEGIN
END
END
IDM_EVENTWR_CTX MENU
BEGIN
POPUP ""
BEGIN
MENUITEM "&Open Event Log...", IDM_OPEN_EVENTLOG
MENUITEM "&Save Event Log as...", IDM_SAVE_EVENTLOG
MENUITEM SEPARATOR
MENUITEM "&Clear all Events", IDM_CLEAR_EVENTS
MENUITEM "&Rename\tF2", IDM_RENAME_EVENTLOG
MENUITEM "Log Se&ttings...", IDM_EVENTLOG_SETTINGS
END
END
IDA_EVENTVWR ACCELERATORS
BEGIN
"?", IDM_ABOUT, ASCII, ALT

View file

@ -41,6 +41,19 @@ BEGIN
END
END
IDM_EVENTWR_CTX MENU
BEGIN
POPUP ""
BEGIN
MENUITEM "&Open Event Log...", IDM_OPEN_EVENTLOG
MENUITEM "&Save Event Log as...", IDM_SAVE_EVENTLOG
MENUITEM SEPARATOR
MENUITEM "&Clear all Events", IDM_CLEAR_EVENTS
MENUITEM "&Rename\tF2", IDM_RENAME_EVENTLOG
MENUITEM "Log Se&ttings...", IDM_EVENTLOG_SETTINGS
END
END
IDA_EVENTVWR ACCELERATORS
BEGIN
"?", IDM_ABOUT, ASCII, ALT

View file

@ -79,6 +79,7 @@
#define IDM_SAVE_SETTINGS 32784
#define IDM_HELP 32785
#define IDM_ABOUT 32786
#define IDM_EVENTWR_CTX 32787
/* String IDs */