activate execution from command bar Modified: trunk/reactos/subsys/system/explorer/shell/mainframe.cpp Modified: trunk/reactos/subsys/system/explorer/shell/mainframe.h _____
Modified: trunk/reactos/subsys/system/explorer/shell/mainframe.cpp --- trunk/reactos/subsys/system/explorer/shell/mainframe.cpp 2005-10-04 14:06:33 UTC (rev 18264) +++ trunk/reactos/subsys/system/explorer/shell/mainframe.cpp 2005-10-04 14:31:11 UTC (rev 18265) @@ -387,7 +387,7 @@
ExecuteDialog dlg = {{0}, 0};
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);
@@ -430,7 +430,8 @@ break;
case IDW_COMMANDBAR: - //@todo execute command in command bar + if (code == 1) + ExecuteCommandbar(NULL); break;
default: @@ -441,6 +442,36 @@ }
+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) { switch(pnmh->code) { @@ -1121,6 +1152,20 @@ MainFrameBase::Create(NULL, false); 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!
default: @@ -1488,6 +1533,11 @@ MainFrameBase::Create(_url, true); break;
+ case IDW_COMMANDBAR: + if (code == 1) + ExecuteCommandbar(_url); + break; + default: return super::Command(id, code); } _____
Modified: trunk/reactos/subsys/system/explorer/shell/mainframe.h --- trunk/reactos/subsys/system/explorer/shell/mainframe.h 2005-10-04 14:06:33 UTC (rev 18264) +++ trunk/reactos/subsys/system/explorer/shell/mainframe.h 2005-10-04 14:31:11 UTC (rev 18265) @@ -81,6 +81,8 @@
void FillBookmarks(); virtual bool go_to(LPCTSTR url, bool new_window); + + void ExecuteCommandbar(LPCTSTR dir); };