mirror of
https://github.com/reactos/reactos.git
synced 2025-07-24 14:34:09 +00:00
Implemented Search and Shut Down in startmenu by calling undocumentd shell32 fucntions
svn path=/trunk/; revision=5871
This commit is contained in:
parent
93082694f4
commit
5207a6524e
5 changed files with 102 additions and 35 deletions
|
@ -20,6 +20,7 @@
|
||||||
#define IDS_NETWORK 16
|
#define IDS_NETWORK 16
|
||||||
#define IDS_CONNECTIONS 17
|
#define IDS_CONNECTIONS 17
|
||||||
#define IDS_DRIVES 18
|
#define IDS_DRIVES 18
|
||||||
|
#define IDS_SEARCH_COMPUTER 19
|
||||||
#define IDI_REACTOS 100
|
#define IDI_REACTOS 100
|
||||||
#define IDI_EXPLORER 101
|
#define IDI_EXPLORER 101
|
||||||
#define IDI_STARTMENU 102
|
#define IDI_STARTMENU 102
|
||||||
|
|
|
@ -106,6 +106,7 @@ BEGIN
|
||||||
IDS_NETWORK "Reþea"
|
IDS_NETWORK "Reþea"
|
||||||
IDS_CONNECTIONS "Conecþii"
|
IDS_CONNECTIONS "Conecþii"
|
||||||
IDS_DRIVES "Discuri"
|
IDS_DRIVES "Discuri"
|
||||||
|
IDS_SEARCH_COMPUTER "Search Computer..."
|
||||||
END
|
END
|
||||||
|
|
||||||
#endif // Romanian resources
|
#endif // Romanian resources
|
||||||
|
@ -363,6 +364,7 @@ BEGIN
|
||||||
IDS_NETWORK "Netzwerk"
|
IDS_NETWORK "Netzwerk"
|
||||||
IDS_CONNECTIONS "Verbindungen"
|
IDS_CONNECTIONS "Verbindungen"
|
||||||
IDS_DRIVES "Verzeichnisse"
|
IDS_DRIVES "Verzeichnisse"
|
||||||
|
IDS_SEARCH_COMPUTER "Suche Computer..."
|
||||||
END
|
END
|
||||||
|
|
||||||
#endif // German (Germany) resources
|
#endif // German (Germany) resources
|
||||||
|
@ -571,6 +573,7 @@ BEGIN
|
||||||
IDS_NETWORK "Network"
|
IDS_NETWORK "Network"
|
||||||
IDS_CONNECTIONS "Connections"
|
IDS_CONNECTIONS "Connections"
|
||||||
IDS_DRIVES "Drives"
|
IDS_DRIVES "Drives"
|
||||||
|
IDS_SEARCH_COMPUTER "Search Computer..."
|
||||||
END
|
END
|
||||||
|
|
||||||
#endif // English (U.S.) resources
|
#endif // English (U.S.) resources
|
||||||
|
|
|
@ -36,24 +36,25 @@
|
||||||
#define DESKTOPBARBAR_HEIGHT 29
|
#define DESKTOPBARBAR_HEIGHT 29
|
||||||
|
|
||||||
|
|
||||||
#define IDC_START 0x1000
|
#define IDC_START 0x1000
|
||||||
#define IDC_LOGOFF 0x1001
|
#define IDC_LOGOFF 0x1001
|
||||||
#define IDC_SHUTDOWN 0x1002
|
#define IDC_SHUTDOWN 0x1002
|
||||||
#define IDC_LAUNCH 0x1003
|
#define IDC_LAUNCH 0x1003
|
||||||
#define IDC_START_HELP 0x1004
|
#define IDC_START_HELP 0x1004
|
||||||
#define IDC_SEARCH 0x1005
|
#define IDC_SEARCH 0x1005
|
||||||
#define IDC_SETTINGS 0x1006
|
#define IDC_SEARCH_COMPUTER 0x1006
|
||||||
#define IDC_ADMIN 0x1007
|
#define IDC_SETTINGS 0x1007
|
||||||
#define IDC_DOCUMENTS 0x1008
|
#define IDC_ADMIN 0x1008
|
||||||
#define IDC_RECENT 0x1009
|
#define IDC_DOCUMENTS 0x1009
|
||||||
#define IDC_FAVORITES 0x100A
|
#define IDC_RECENT 0x100A
|
||||||
#define IDC_PROGRAMS 0x100B
|
#define IDC_FAVORITES 0x100B
|
||||||
#define IDC_EXPLORE 0x100C
|
#define IDC_PROGRAMS 0x100C
|
||||||
#define IDC_NETWORK 0x100D
|
#define IDC_EXPLORE 0x100D
|
||||||
#define IDC_CONNECTIONS 0x100E
|
#define IDC_NETWORK 0x100E
|
||||||
#define IDC_DRIVES 0x100F
|
#define IDC_CONNECTIONS 0x100F
|
||||||
|
#define IDC_DRIVES 0x1010
|
||||||
|
|
||||||
#define IDC_FIRST_MENU 0x3000
|
#define IDC_FIRST_MENU 0x3000
|
||||||
|
|
||||||
|
|
||||||
/// desktop bar window, also known as "system tray"
|
/// desktop bar window, also known as "system tray"
|
||||||
|
|
|
@ -573,23 +573,24 @@ LRESULT StartMenuRoot::Init(LPCREATESTRUCT pcs)
|
||||||
AddSeparator();
|
AddSeparator();
|
||||||
|
|
||||||
// insert hard coded start entries
|
// insert hard coded start entries
|
||||||
AddButton(ResString(IDS_PROGRAMS), 0, true, IDC_PROGRAMS);
|
AddButton(ResString(IDS_PROGRAMS), 0, true, IDC_PROGRAMS);
|
||||||
AddButton(ResString(IDS_FAVORITES), 0, true, IDC_FAVORITES);
|
AddButton(ResString(IDS_FAVORITES), 0, true, IDC_FAVORITES);
|
||||||
AddButton(ResString(IDS_DOCUMENTS), 0, true, IDC_DOCUMENTS);
|
AddButton(ResString(IDS_DOCUMENTS), 0, true, IDC_DOCUMENTS);
|
||||||
AddButton(ResString(IDS_RECENT), 0, true, IDC_RECENT);
|
AddButton(ResString(IDS_RECENT), 0, true, IDC_RECENT);
|
||||||
AddButton(ResString(IDS_SETTINGS), 0, true, IDC_SETTINGS);
|
AddButton(ResString(IDS_SETTINGS), 0, true, IDC_SETTINGS);
|
||||||
AddButton(ResString(IDS_ADMIN), 0, true, IDC_ADMIN);
|
AddButton(ResString(IDS_ADMIN), 0, true, IDC_ADMIN);
|
||||||
AddButton(ResString(IDS_DRIVES), 0, true, IDC_DRIVES);
|
AddButton(ResString(IDS_DRIVES), 0, true, IDC_DRIVES);
|
||||||
AddButton(ResString(IDS_NETWORK), 0, true, IDC_NETWORK);
|
AddButton(ResString(IDS_NETWORK), 0, true, IDC_NETWORK);
|
||||||
AddButton(ResString(IDS_CONNECTIONS),0,true, IDC_CONNECTIONS);
|
AddButton(ResString(IDS_CONNECTIONS), 0, true, IDC_CONNECTIONS);
|
||||||
AddButton(ResString(IDS_SEARCH), 0, false, IDC_SEARCH);
|
AddButton(ResString(IDS_SEARCH), 0, false, IDC_SEARCH);
|
||||||
AddButton(ResString(IDS_START_HELP),0, false, IDC_START_HELP);
|
AddButton(ResString(IDS_SEARCH_COMPUTER),0,false, IDC_SEARCH_COMPUTER);
|
||||||
AddButton(ResString(IDS_LAUNCH), 0, false, IDC_LAUNCH);
|
AddButton(ResString(IDS_START_HELP), 0, false, IDC_START_HELP);
|
||||||
|
AddButton(ResString(IDS_LAUNCH), 0, false, IDC_LAUNCH);
|
||||||
|
|
||||||
AddSeparator();
|
AddSeparator();
|
||||||
|
|
||||||
AddButton(ResString(IDS_SHUTDOWN), SmallIcon(IDI_LOGOFF), false, IDC_SHUTDOWN);
|
|
||||||
AddButton(ResString(IDS_LOGOFF), SmallIcon(IDI_LOGOFF), false, IDC_LOGOFF);
|
AddButton(ResString(IDS_LOGOFF), SmallIcon(IDI_LOGOFF), false, IDC_LOGOFF);
|
||||||
|
AddButton(ResString(IDS_SHUTDOWN), SmallIcon(IDI_LOGOFF), false, IDC_SHUTDOWN);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -675,14 +676,28 @@ int StartMenuRoot::Command(int id, int code)
|
||||||
CreateSubmenu(id, CSIDL_DRIVES);
|
CreateSubmenu(id, CSIDL_DRIVES);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDC_LOGOFF:
|
case IDC_SEARCH:
|
||||||
DestroyWindow(GetParent(_hwnd)); //TODO: show dialog and ask for acknowledge
|
ShowSearchDialog();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDC_SHUTDOWN:
|
case IDC_SEARCH_COMPUTER:
|
||||||
DestroyWindow(GetParent(_hwnd)); //TODO: show dialog box and shut down system
|
ShowSearchComputer();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case IDC_LOGOFF:
|
||||||
|
/* The shell32 Dialog prompts about some system setting change. This is not what we want to display here.
|
||||||
|
HWND hwndDesktopBar = GetWindow(_hwnd, GW_OWNER);
|
||||||
|
CloseStartMenu(id);
|
||||||
|
ShowRestartDialog(hwndDesktopBar, EWX_LOGOFF);*/
|
||||||
|
DestroyWindow(GetParent(_hwnd));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case IDC_SHUTDOWN: {
|
||||||
|
HWND hwndDesktopBar = GetWindow(_hwnd, GW_OWNER);
|
||||||
|
CloseStartMenu(id);
|
||||||
|
ShowExitWindowsDialog(hwndDesktopBar);
|
||||||
|
break;}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return super::Command(id, code);
|
return super::Command(id, code);
|
||||||
}
|
}
|
||||||
|
@ -716,6 +731,42 @@ void StartMenuRoot::ShowLaunchDialog(HWND hwndDesktopBar)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void StartMenuRoot::ShowExitWindowsDialog(HWND hwndOwner)
|
||||||
|
{
|
||||||
|
HMODULE hShell32 = GetModuleHandle(_T("SHELL32"));
|
||||||
|
EXITWINDOWSDLG ExitWindowsDlg = (EXITWINDOWSDLG)GetProcAddress(hShell32, (LPCSTR)60);
|
||||||
|
|
||||||
|
if (ExitWindowsDlg)
|
||||||
|
ExitWindowsDlg(hwndOwner);
|
||||||
|
}
|
||||||
|
|
||||||
|
void StartMenuRoot::ShowRestartDialog(HWND hwndOwner, UINT flags)
|
||||||
|
{
|
||||||
|
HMODULE hShell32 = GetModuleHandle(_T("SHELL32"));
|
||||||
|
RESTARTWINDOWSDLG RestartDlg = (RESTARTWINDOWSDLG)GetProcAddress(hShell32, (LPCSTR)59);
|
||||||
|
|
||||||
|
if (RestartDlg)
|
||||||
|
RestartDlg(hwndOwner, L"You selected <Log Off>.\n\n", flags); //TODO: ANSI string conversion if needed
|
||||||
|
}
|
||||||
|
|
||||||
|
void StartMenuRoot::ShowSearchDialog()
|
||||||
|
{
|
||||||
|
HMODULE hShell32 = GetModuleHandle(_T("SHELL32"));
|
||||||
|
SHFINDFILES SHFindFiles = (SHFINDFILES)GetProcAddress(hShell32, (LPCSTR)90);
|
||||||
|
|
||||||
|
if (SHFindFiles)
|
||||||
|
SHFindFiles(NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void StartMenuRoot::ShowSearchComputer()
|
||||||
|
{
|
||||||
|
HMODULE hShell32 = GetModuleHandle(_T("SHELL32"));
|
||||||
|
SHFINDCOMPUTER SHFindComputer = (SHFINDCOMPUTER)GetProcAddress(hShell32, (LPCSTR)91);
|
||||||
|
|
||||||
|
if (SHFindComputer)
|
||||||
|
SHFindComputer(NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
RecentStartMenu::RecentStartMenu(HWND hwnd, const StartMenuFolders& info)
|
RecentStartMenu::RecentStartMenu(HWND hwnd, const StartMenuFolders& info)
|
||||||
: super(hwnd, info)
|
: super(hwnd, info)
|
||||||
|
|
|
@ -191,6 +191,13 @@ typedef void (WINAPI* RUNFILEDLG)(HWND hwndOwner, HICON hIcon, LPCSTR lpstrDirec
|
||||||
#define RFF_NOSEPARATEMEM 0x20 // Removes the Separate Memory Space check box (Windows NT only).
|
#define RFF_NOSEPARATEMEM 0x20 // Removes the Separate Memory Space check box (Windows NT only).
|
||||||
|
|
||||||
|
|
||||||
|
// declare more undocumented shell32 functions
|
||||||
|
typedef void (WINAPI* EXITWINDOWSDLG)(HWND hwndOwner);
|
||||||
|
typedef int (WINAPI* RESTARTWINDOWSDLG)(HWND hwndOwner, LPCWSTR reason, UINT flags);
|
||||||
|
typedef BOOL (WINAPI* SHFINDFILES)(LPCITEMIDLIST pidlRoot, LPCITEMIDLIST pidlSavedSearch);
|
||||||
|
typedef BOOL (WINAPI* SHFINDCOMPUTER)(LPCITEMIDLIST pidlRoot, LPCITEMIDLIST pidlSavedSearch);
|
||||||
|
|
||||||
|
|
||||||
// Startmenu root window
|
// Startmenu root window
|
||||||
struct StartMenuRoot : public StartMenu
|
struct StartMenuRoot : public StartMenu
|
||||||
{
|
{
|
||||||
|
@ -205,7 +212,11 @@ protected:
|
||||||
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam);
|
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam);
|
||||||
int Command(int id, int code);
|
int Command(int id, int code);
|
||||||
|
|
||||||
void ShowLaunchDialog(HWND hwndDesktopBar);
|
static void ShowLaunchDialog(HWND hwndDesktopBar);
|
||||||
|
static void ShowExitWindowsDialog(HWND hwndOwner);
|
||||||
|
static void ShowRestartDialog(HWND hwndOwner, UINT flags);
|
||||||
|
static void ShowSearchDialog();
|
||||||
|
static void ShowSearchComputer();
|
||||||
|
|
||||||
SIZE _logo_size;
|
SIZE _logo_size;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue