mirror of
https://github.com/reactos/reactos.git
synced 2024-08-08 04:08:29 +00:00
implemented 'run...' dialog by using shell32 functionality (taken from taskmgr/run.c)
svn path=/trunk/; revision=5789
This commit is contained in:
parent
ea2e4b1c26
commit
43fa5d1ab2
|
@ -438,11 +438,10 @@ void StartMenu::CloseStartMenu(int id)
|
||||||
|
|
||||||
int StartMenuButton::GetTextWidth(LPCTSTR title)
|
int StartMenuButton::GetTextWidth(LPCTSTR title)
|
||||||
{
|
{
|
||||||
RECT rect = {0, 0, 0, 0};
|
|
||||||
|
|
||||||
HDC hdc = GetDC(0);
|
HDC hdc = GetDC(0);
|
||||||
SelectedFont font(hdc, GetStockFont(DEFAULT_GUI_FONT));
|
FontSelection font(hdc, GetStockFont(DEFAULT_GUI_FONT));
|
||||||
|
|
||||||
|
RECT rect = {0, 0, 0, 0};
|
||||||
DrawText(hdc, title, -1, &rect, DT_SINGLELINE|DT_NOPREFIX|DT_CALCRECT);
|
DrawText(hdc, title, -1, &rect, DT_SINGLELINE|DT_NOPREFIX|DT_CALCRECT);
|
||||||
|
|
||||||
ReleaseDC(0, hdc);
|
ReleaseDC(0, hdc);
|
||||||
|
@ -539,6 +538,7 @@ StartMenuRoot::StartMenuRoot(HWND hwnd)
|
||||||
_dirs.push_back(StartMenuDirectory(usr_startmenu, false)); // dont't add subfolders
|
_dirs.push_back(StartMenuDirectory(usr_startmenu, false)); // dont't add subfolders
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
HWND StartMenuRoot::Create(HWND hwndDesktopBar)
|
HWND StartMenuRoot::Create(HWND hwndDesktopBar)
|
||||||
{
|
{
|
||||||
WindowRect pos(hwndDesktopBar);
|
WindowRect pos(hwndDesktopBar);
|
||||||
|
@ -547,6 +547,7 @@ HWND StartMenuRoot::Create(HWND hwndDesktopBar)
|
||||||
WS_POPUP|WS_THICKFRAME|WS_CLIPCHILDREN|WS_VISIBLE, pos.left, pos.top-4, STARTMENU_WIDTH_MIN, 4, hwndDesktopBar);
|
WS_POPUP|WS_THICKFRAME|WS_CLIPCHILDREN|WS_VISIBLE, pos.left, pos.top-4, STARTMENU_WIDTH_MIN, 4, hwndDesktopBar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LRESULT StartMenuRoot::Init(LPCREATESTRUCT pcs)
|
LRESULT StartMenuRoot::Init(LPCREATESTRUCT pcs)
|
||||||
{
|
{
|
||||||
// add buttons for entries in _entries
|
// add buttons for entries in _entries
|
||||||
|
@ -578,6 +579,7 @@ LRESULT StartMenuRoot::Init(LPCREATESTRUCT pcs)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int StartMenuRoot::Command(int id, int code)
|
int StartMenuRoot::Command(int id, int code)
|
||||||
{
|
{
|
||||||
switch(id) {
|
switch(id) {
|
||||||
|
@ -590,6 +592,12 @@ int StartMenuRoot::Command(int id, int code)
|
||||||
CloseStartMenu(id);
|
CloseStartMenu(id);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case IDC_LAUNCH: {
|
||||||
|
HWND hwndDesktopBar = GetWindow(_hwnd, GW_OWNER);
|
||||||
|
CloseStartMenu(id);
|
||||||
|
ShowLaunchDialog(hwndDesktopBar);
|
||||||
|
break;}
|
||||||
|
|
||||||
case IDC_DOCUMENTS:
|
case IDC_DOCUMENTS:
|
||||||
CreateSubmenu(id, CSIDL_PERSONAL);
|
CreateSubmenu(id, CSIDL_PERSONAL);
|
||||||
break;
|
break;
|
||||||
|
@ -634,6 +642,32 @@ int StartMenuRoot::Command(int id, int code)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void StartMenuRoot::ShowLaunchDialog(HWND hwndDesktopBar)
|
||||||
|
{
|
||||||
|
//TODO: All text phrases should be put into the resources.
|
||||||
|
static LPCSTR szTitle = "Create New Task";
|
||||||
|
static LPCSTR szText = "Type the name of a program, folder, document, or Internet resource, and Task Manager will open it for you.";
|
||||||
|
|
||||||
|
HMODULE hShell32 = GetModuleHandle(_T("SHELL32"));
|
||||||
|
RUNFILEDLG RunFileDlg = (RUNFILEDLG)GetProcAddress(hShell32, (LPCSTR)61);
|
||||||
|
|
||||||
|
// Show "Run..." dialog
|
||||||
|
if (RunFileDlg) {
|
||||||
|
#define W_VER_NT 0
|
||||||
|
if ((HIWORD(GetVersion())>>14) == W_VER_NT) {
|
||||||
|
WCHAR wTitle[40], wText[256];
|
||||||
|
|
||||||
|
MultiByteToWideChar(CP_ACP, 0, szTitle, -1, wTitle, 40);
|
||||||
|
MultiByteToWideChar(CP_ACP, 0, szText, -1, wText, 256);
|
||||||
|
|
||||||
|
RunFileDlg(hwndDesktopBar, 0, NULL, (LPCSTR)wTitle, (LPCSTR)wText, RFF_CALCDIRECTORY);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
RunFileDlg(hwndDesktopBar, 0, NULL, szTitle, szText, RFF_CALCDIRECTORY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
RecentStartMenu::RecentStartMenu(HWND hwnd, const StartMenuFolders& info)
|
RecentStartMenu::RecentStartMenu(HWND hwnd, const StartMenuFolders& info)
|
||||||
: super(hwnd, info)
|
: super(hwnd, info)
|
||||||
{
|
{
|
||||||
|
|
|
@ -168,6 +168,20 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// declare shell32's "Run..." dialog export function
|
||||||
|
typedef void (WINAPI* RUNFILEDLG)(HWND hwndOwner, HICON hIcon, LPCSTR lpstrDirectory, LPCSTR lpstrTitle, LPCSTR lpstrDescription, UINT uFlags);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Flags for RunFileDlg
|
||||||
|
//
|
||||||
|
|
||||||
|
#define RFF_NOBROWSE 0x01 // Removes the browse button.
|
||||||
|
#define RFF_NODEFAULT 0x02 // No default item selected.
|
||||||
|
#define RFF_CALCDIRECTORY 0x04 // Calculates the working directory from the file name.
|
||||||
|
#define RFF_NOLABEL 0x08 // Removes the edit box label.
|
||||||
|
#define RFF_NOSEPARATEMEM 0x20 // Removes the Separate Memory Space check box (Windows NT only).
|
||||||
|
|
||||||
|
|
||||||
// Startmenu root window
|
// Startmenu root window
|
||||||
struct StartMenuRoot : public StartMenu
|
struct StartMenuRoot : public StartMenu
|
||||||
{
|
{
|
||||||
|
@ -180,6 +194,8 @@ struct StartMenuRoot : public StartMenu
|
||||||
protected:
|
protected:
|
||||||
LRESULT Init(LPCREATESTRUCT pcs);
|
LRESULT Init(LPCREATESTRUCT pcs);
|
||||||
int Command(int id, int code);
|
int Command(int id, int code);
|
||||||
|
|
||||||
|
void ShowLaunchDialog(HWND hwndDesktopBar);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue