Skip to content
This repository has been archived by the owner on Jun 18, 2023. It is now read-only.

Commit

Permalink
issue #13 右键菜单增加以管理员方式运行("运行为").
Browse files Browse the repository at this point in the history
  • Loading branch information
chenall committed Dec 28, 2014
1 parent c1ee91d commit 8e2b2e0
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 7 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,17 @@ ALMRun Base 基本功能
* 程序相关快捷键
* `ALT+R`(全局)    隐藏激活程序(可在参数配置中修改)
* `ALT+L`(全局)    运行上一个命令(可改)
* `CTRL+D`       自动定位所选条目的文件位置,方便查找
* `Alt+C`       打开参数配置界面
* `Alt+S`       打开命令管理器
* `Alt+X`       退出程序
* `Tab`        选定条目,并且进入输入参数模式。
* `Ctrl+N/Alt+N`   N=0-9,启动列表中对应的条目
* `Enter`       启动程序
* `F1`        显示关于窗口
* `F2`        编辑当前项目
* `Insert`      添加新的命令 (菜单: **添加**)
* `F2`        编辑当前项目 (菜单: **编辑**)
* `CTRL+D`      自动定位所选条目的文件位置,方便查找(菜单: **定位**)
* `Shift+Enter`   以其它户用运行当前项目(菜单: **运行为**)
* `Enter`      启动程序
* `F1`        显示关于窗口
* 基本操作

输入要启动的程序名(支持任意位置匹配和中文首字母识别),筛选过虑列表清单。然后根据列表框选择要启动的程序,如果需要输入参数可按`Tab`键,否则直接启动程序。如果在配置中勾选了“允许数字快捷键“,还支持直接按数字键0-9来启动,或按空格键来启动当前选择条目。
Expand Down
2 changes: 2 additions & 0 deletions doc/update.log
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
### [v1.2.0.72](https://github.com/chenall/ALMRun/releases/tag/v1.2.0.72)
2014-12-28
1. issue #13 右键菜单增加以管理员方式运行("运行为").(快捷键Shift+Enter)
2014-12-21
1. 修正包含空格的文件名没有正确处理的问题(issue #14).
2014-12-22
Expand Down
8 changes: 8 additions & 0 deletions src/ALMRunConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@ class ALMRunConfig
extern ALMRunConfig* g_config;
extern SkinConfig *skin;
extern bool LocationExec;
extern int cmdrun_flags;

#define CMDRUN_FLAG_RUNAS 1
#define CMDRUN_FLAG_HIDE 2
#define CMDRUN_FLAG_FORCEARG 4

enum
{
MENU_ITEM_FIRST = 10000,
Expand All @@ -148,6 +154,8 @@ enum
MENU_CMD_EDIT,
MENU_CMD_OPENDIR,
MENU_CMD_INFO,
MENU_CMD_RUNAS,
MENU_CMD_RUNHIDE,
MENU_CMD_LAST,
};
#endif
6 changes: 4 additions & 2 deletions src/MerryControllerWindows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -468,10 +468,12 @@ DWORD MerryController::ShellExecute(const wxString& commandName,
}

wxString cmdName = commandName.substr(n);
if (cmdrun_flags & CMDRUN_FLAG_RUNAS) runas = true;
if (cmdrun_flags & CMDRUN_FLAG_HIDE) showCommand = SW_HIDE;
cmdrun_flags = 0;

if (!LocationExec)
{

__DEBUG_BEGIN(cmdName.c_str());
SHELLEXECUTEINFO ShExecInfo = {0};
ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
Expand All @@ -483,7 +485,6 @@ DWORD MerryController::ShellExecute(const wxString& commandName,
ShExecInfo.lpDirectory = workingDir.c_str();
ShExecInfo.nShow = showCommand;
ShExecInfo.hInstApp = NULL;

if (::ShellExecuteEx(&ShExecInfo))
return SavePid?GetProcessId(ShExecInfo.hProcess):1;
return 0;
Expand All @@ -495,6 +496,7 @@ DWORD MerryController::ShellExecute(const wxString& commandName,
return 0;

FullcmdName.Replace('/','\\');

#ifdef _ALMRUN_CONFIG_H_
if (!g_config->Explorer.empty())
::WinExec(wxString::Format("%s \"%s\"",g_config->Explorer,FullcmdName),SW_SHOW);
Expand Down
6 changes: 5 additions & 1 deletion src/MerryListBoxPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ void MerryListBoxPanel::onContextMenu(wxContextMenuEvent& e)
}
menu.Append(MENU_CMD_OPENDIR, wxT("定位(&L)"));
menu.Append(MENU_CMD_INFO, wxT("详情(&M)"));
menu.Append(MENU_CMD_RUNAS, wxT("运行为(&A)"));

PopupMenu(&menu);
}
Expand Down Expand Up @@ -265,7 +266,10 @@ void MerryListBoxPanel::onPopMenu(wxCommandEvent& e)
LocationExec = true;
GetSelectionCommand()->Execute(wxEmptyString);
break;

case MENU_CMD_RUNAS:
cmdrun_flags |= CMDRUN_FLAG_RUNAS;
GetSelectionCommand()->Execute(wxEmptyString);
break;
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/MerryTextCtrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#pragma comment(lib, "imm32.lib")
#endif

int cmdrun_flags;
bool LocationExec;
#ifdef __WXMSW__
HWND HWND_TEXTCTRL = NULL;
Expand Down Expand Up @@ -211,6 +212,7 @@ void MerryTextCtrl::OnKeyDownEvent(wxKeyEvent& e)
{
case WXK_RETURN:
case WXK_NUMPAD_ENTER:
if (e.ShiftDown()) cmdrun_flags |= CMDRUN_FLAG_RUNAS;
this->ExecuteCmd();
break;
case WXK_ESCAPE:
Expand Down

0 comments on commit 8e2b2e0

Please sign in to comment.