最近在试着写一个小软件,有一个功能是得用管理员模式打开另一个程序。。。但是我本身的程序又不是管理员权限的。。。所以就在研究怎么弄。。。多方谷歌之后找到了办法,存个档防止以后忘了~
需要的API是ShellExcuteEx,结构体SHELLEXECUTEINFO。
结构体定义如下:
class SHELLEXECUTEINFO {
INT cbSize;
INT fMask;
int hwnd;
string lpVerb;
string lpFile;
string lpParameters;
string lpDirectory;
int nShow;
int hInstApp;
pointer lpIDList;
string lpClass;
int hkeyClass;
INT dwHotKey;
union DUMMYUNIONNAME = {
int hIcon;
int hMonitor;
};
int hProcess;
}
C++中定义参见MSDN:
点击打开链接