mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 08:32:58 +00:00
activate execution from command bar
svn path=/trunk/; revision=18265
This commit is contained in:
parent
b43dd57063
commit
55265598c2
2 changed files with 54 additions and 2 deletions
|
@ -387,7 +387,7 @@ int MainFrameBase::Command(int id, int code)
|
||||||
ExecuteDialog dlg = {{0}, 0};
|
ExecuteDialog dlg = {{0}, 0};
|
||||||
|
|
||||||
if (DialogBoxParam(g_Globals._hInstance, MAKEINTRESOURCE(IDD_EXECUTE), _hwnd, ExecuteDialog::WndProc, (LPARAM)&dlg) == IDOK) {
|
if (DialogBoxParam(g_Globals._hInstance, MAKEINTRESOURCE(IDD_EXECUTE), _hwnd, ExecuteDialog::WndProc, (LPARAM)&dlg) == IDOK) {
|
||||||
CONTEXT("ShellExecute()");
|
CONTEXT("ID_EXECUTE - ShellExecute()");
|
||||||
|
|
||||||
HINSTANCE hinst = ShellExecute(_hwnd, NULL/*operation*/, dlg.cmd/*file*/, NULL/*parameters*/, NULL/*dir*/, dlg.cmdshow);
|
HINSTANCE hinst = ShellExecute(_hwnd, NULL/*operation*/, dlg.cmd/*file*/, NULL/*parameters*/, NULL/*dir*/, dlg.cmdshow);
|
||||||
|
|
||||||
|
@ -430,7 +430,8 @@ int MainFrameBase::Command(int id, int code)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDW_COMMANDBAR:
|
case IDW_COMMANDBAR:
|
||||||
//@todo execute command in command bar
|
if (code == 1)
|
||||||
|
ExecuteCommandbar(NULL);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -441,6 +442,36 @@ int MainFrameBase::Command(int id, int code)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MainFrameBase::ExecuteCommandbar(LPCTSTR dir)
|
||||||
|
{
|
||||||
|
TCHAR cmd[BUFFER_LEN];
|
||||||
|
|
||||||
|
if (GetWindowText(_hcommandedit, cmd, BUFFER_LEN)) {
|
||||||
|
CONTEXT("ExecuteCommandbar - ShellExecute()");
|
||||||
|
|
||||||
|
// remove command prompt from 'cmd' string
|
||||||
|
LPCTSTR p = cmd;
|
||||||
|
|
||||||
|
if (*p == '>')
|
||||||
|
++p;
|
||||||
|
|
||||||
|
while(*p == ' ')
|
||||||
|
++p;
|
||||||
|
|
||||||
|
if (dir) {
|
||||||
|
// remove "file://" from directory URL
|
||||||
|
if (!_tcsnicmp(dir, TEXT("file://"), 7))
|
||||||
|
dir += 7;
|
||||||
|
}
|
||||||
|
|
||||||
|
HINSTANCE hinst = ShellExecute(_hwnd, NULL, p, NULL, dir, SW_SHOWNORMAL);
|
||||||
|
|
||||||
|
if ((int)hinst <= 32)
|
||||||
|
display_error(_hwnd, GetLastError());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int MainFrameBase::Notify(int id, NMHDR* pnmh)
|
int MainFrameBase::Notify(int id, NMHDR* pnmh)
|
||||||
{
|
{
|
||||||
switch(pnmh->code) {
|
switch(pnmh->code) {
|
||||||
|
@ -1121,6 +1152,20 @@ int MDIMainFrame::Command(int id, int code)
|
||||||
MainFrameBase::Create(NULL, false);
|
MainFrameBase::Create(NULL, false);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case IDW_COMMANDBAR:
|
||||||
|
if (code == 1) {
|
||||||
|
TCHAR url[BUFFER_LEN];
|
||||||
|
LPCTSTR dir;
|
||||||
|
|
||||||
|
if (GetWindowText(_haddressedit, url, BUFFER_LEN))
|
||||||
|
dir = url;
|
||||||
|
else
|
||||||
|
dir = NULL;
|
||||||
|
|
||||||
|
ExecuteCommandbar(dir);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
///@todo There are even more menu items!
|
///@todo There are even more menu items!
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -1488,6 +1533,11 @@ int SDIMainFrame::Command(int id, int code)
|
||||||
MainFrameBase::Create(_url, true);
|
MainFrameBase::Create(_url, true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case IDW_COMMANDBAR:
|
||||||
|
if (code == 1)
|
||||||
|
ExecuteCommandbar(_url);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return super::Command(id, code);
|
return super::Command(id, code);
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,6 +81,8 @@ protected:
|
||||||
|
|
||||||
void FillBookmarks();
|
void FillBookmarks();
|
||||||
virtual bool go_to(LPCTSTR url, bool new_window);
|
virtual bool go_to(LPCTSTR url, bool new_window);
|
||||||
|
|
||||||
|
void ExecuteCommandbar(LPCTSTR dir);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue