- Add the task manager to the tray context menu

- Add a bit of code for the tray properties dialog

svn path=/trunk/; revision=41848
This commit is contained in:
Ged Murphy 2009-07-10 17:10:20 +00:00
parent 8333c72806
commit c58c9ebb32
4 changed files with 216 additions and 1 deletions

View file

@ -4,6 +4,10 @@ IDM_TRAYWND MENU DISCARDABLE
BEGIN
POPUP ""
BEGIN
MENUITEM SEPARATOR
MENUITEM "Task Manager", ID_SHELL_CMD_OPEN_TASKMGR
MENUITEM SEPARATOR
MENUITEM "&Lock the Taskbar", ID_LOCKTASKBAR
MENUITEM "P&roperties", ID_SHELL_CMD_PROPERTIES
END
@ -57,3 +61,8 @@ BEGIN
IDS_OPEN_ALL_USERS "O&pen All Users"
IDS_EXPLORE_ALL_USERS "E&xplore All Users"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_TASKBAR_STARTMENU_PROP_CAPTION "Taskbar and Start Menu Properties"
END

View file

@ -21,6 +21,7 @@
#define ID_SHELL_CMD_OPEN_ALL_USERS (ID_SHELL_CMD_LAST + 2)
#define ID_SHELL_CMD_EXPLORE_ALL_USERS (ID_SHELL_CMD_LAST + 3)
#define ID_LOCKTASKBAR (ID_SHELL_CMD_LAST + 4)
#define ID_SHELL_CMD_OPEN_TASKMGR (ID_SHELL_CMD_LAST + 5)
/* NOTE: The following constants may *NOT* be changed because
they're hardcoded and need to be the exact values
@ -44,4 +45,12 @@
#define IDM_SHUTDOWN 506
#define IDM_LASTSTARTMENU_SEPARATOR 450
/* Taskbar resources */
#define IDD_TASKBARPAGE 2000
#define IDD_STARTMENUPAGE 2001
#define IDD_NOTIFICATIONPAGE 2002
#define IDD_TOOLBARSPAGE 2003
#define IDS_TASKBAR_STARTMENU_PROP_CAPTION 2200
#endif /* __RESOURCE_H */

View file

@ -20,10 +20,191 @@
#include <precomp.h>
INT_PTR CALLBACK
TaskbarPageProc(HWND hwndDlg,
UINT uMsg,
WPARAM wParam,
LPARAM lParam)
{
switch (uMsg)
{
case WM_INITDIALOG:
break;
case WM_DESTROY:
break;
case WM_NOTIFY:
{
LPNMHDR pnmh = (LPNMHDR)lParam;
switch(pnmh->code)
{
case PSN_SETACTIVE:
break;
case PSN_APPLY:
break;
}
break;
}
}
return FALSE;
}
INT_PTR CALLBACK
StartMenuPageProc(HWND hwndDlg,
UINT uMsg,
WPARAM wParam,
LPARAM lParam)
{
switch (uMsg)
{
case WM_INITDIALOG:
break;
case WM_DESTROY:
break;
case WM_NOTIFY:
{
LPNMHDR pnmh = (LPNMHDR)lParam;
switch(pnmh->code)
{
case PSN_SETACTIVE:
break;
case PSN_APPLY:
break;
}
break;
}
}
return FALSE;
}
INT_PTR CALLBACK
NotificationPageProc(HWND hwndDlg,
UINT uMsg,
WPARAM wParam,
LPARAM lParam)
{
switch (uMsg)
{
case WM_INITDIALOG:
break;
case WM_DESTROY:
break;
case WM_NOTIFY:
{
LPNMHDR pnmh = (LPNMHDR)lParam;
switch(pnmh->code)
{
case PSN_SETACTIVE:
break;
case PSN_APPLY:
break;
}
break;
}
}
return FALSE;
}
INT_PTR CALLBACK
ToolbarsPageProc(HWND hwndDlg,
UINT uMsg,
WPARAM wParam,
LPARAM lParam)
{
switch (uMsg)
{
case WM_INITDIALOG:
break;
case WM_DESTROY:
break;
case WM_NOTIFY:
{
LPNMHDR pnmh = (LPNMHDR)lParam;
switch(pnmh->code)
{
case PSN_SETACTIVE:
break;
case PSN_APPLY:
break;
}
break;
}
}
return FALSE;
}
static VOID
InitPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DLGPROC DlgProc)
{
ZeroMemory(psp, sizeof(PROPSHEETPAGE));
psp->dwSize = sizeof(PROPSHEETPAGE);
psp->dwFlags = PSP_DEFAULT;
psp->hInstance = hExplorerInstance;
psp->pszTemplate = MAKEINTRESOURCE(idDlg);
psp->pfnDlgProc = DlgProc;
}
HWND
DisplayTrayProperties(ITrayWindow *Tray)
{
DbgPrint("DisplayTrayProperties() not implemented!\n");
PROPSHEETHEADER psh;
PROPSHEETPAGE psp[4];
TCHAR szCaption[256];
#if 1
MessageBox(NULL, _T("Not implemented"), NULL, 0);
return NULL;
#endif
if (!LoadString(hExplorerInstance,
IDS_TASKBAR_STARTMENU_PROP_CAPTION,
szCaption,
sizeof(szCaption) / sizeof(szCaption[0])))
{
return NULL;
}
ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
psh.dwSize = sizeof(PROPSHEETHEADER);
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_PROPTITLE;
psh.hwndParent = NULL;
psh.hInstance = hExplorerInstance;
psh.hIcon = NULL;
psh.pszCaption = szCaption;
psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
psh.nStartPage = 0;
psh.ppsp = psp;
InitPropSheetPage(&psp[0], IDD_TASKBARPAGE, (DLGPROC)TaskbarPageProc);
InitPropSheetPage(&psp[1], IDD_STARTMENUPAGE, (DLGPROC)StartMenuPageProc);
InitPropSheetPage(&psp[2], IDD_NOTIFICATIONPAGE, (DLGPROC)NotificationPageProc);
InitPropSheetPage(&psp[3], IDD_TOOLBARSPAGE, (DLGPROC)ToolbarsPageProc);
return (HWND)PropertySheet(&psh);
}

View file

@ -1697,6 +1697,17 @@ OpenCommonStartMenuDirectory(IN HWND hWndOwner,
}
}
static VOID
OpenTaskManager(IN HWND hWndOwner)
{
ShellExecute(hWndOwner,
TEXT("open"),
TEXT("taskmgr.exe"),
NULL,
NULL,
SW_SHOWNORMAL);
}
static BOOL STDMETHODCALLTYPE
ITrayWindowImpl_ExecContextMenuCmd(IN OUT ITrayWindow *iface,
IN UINT uiCmd)
@ -1728,6 +1739,11 @@ ITrayWindowImpl_ExecContextMenuCmd(IN OUT ITrayWindow *iface,
}
break;
case ID_SHELL_CMD_OPEN_TASKMGR:
OpenTaskManager(This->hWnd);
break;
default:
DbgPrint("ITrayWindow::ExecContextMenuCmd(%u): Unhandled Command ID!\n", uiCmd);
bHandled = FALSE;