以管理员身份运行指定程序 visual c++
2013-10-22 10:16
633 查看
_declspec(dllexport)
int WINAPI icePub_runByAdmin(char *strAppPathName,char *strSuParam);
//以管理员身份运行指定程序 visual c++
int runByAdmin(void)
{
int retCode=-1;
typedef int (WINAPI ICEPUB_RUNBYADMIN)(char *strAppPathName,char *strSuParam);
ICEPUB_RUNBYADMIN *icePub_runByAdmin = 0;
HINSTANCE hDLLDrv = LoadLibrary("icePubDll.dll");
if(hDLLDrv)
icePub_runByAdmin = (ICEPUB_RUNBYADMIN *)GetProcAddress(hDLLDrv, "icePub_runByAdmin");
if(icePub_runByAdmin)
retCode=icePub_runByAdmin("E:\\c++\\IsAdmin\\setup.bat","");
if(hDLLDrv)
FreeLibrary(hDLLDrv);
if(retCode == 0)
exit(0);
if(retCode == -1)
AfxMessageBox("以管理员启动失败,请手动启动");
return retCode;
}
icePubDll.dll 下载地址:
http://www.pudn.com/downloads369/sourcecode/windows/detail1598958.html
int WINAPI icePub_runByAdmin(char *strAppPathName,char *strSuParam);
//以管理员身份运行指定程序 visual c++
int runByAdmin(void)
{
int retCode=-1;
typedef int (WINAPI ICEPUB_RUNBYADMIN)(char *strAppPathName,char *strSuParam);
ICEPUB_RUNBYADMIN *icePub_runByAdmin = 0;
HINSTANCE hDLLDrv = LoadLibrary("icePubDll.dll");
if(hDLLDrv)
icePub_runByAdmin = (ICEPUB_RUNBYADMIN *)GetProcAddress(hDLLDrv, "icePub_runByAdmin");
if(icePub_runByAdmin)
retCode=icePub_runByAdmin("E:\\c++\\IsAdmin\\setup.bat","");
if(hDLLDrv)
FreeLibrary(hDLLDrv);
if(retCode == 0)
exit(0);
if(retCode == -1)
AfxMessageBox("以管理员启动失败,请手动启动");
return retCode;
}
icePubDll.dll 下载地址:
http://www.pudn.com/downloads369/sourcecode/windows/detail1598958.html
相关文章推荐
- Runas命令能让域用户/普通User用户以管理员身份运行指定程序
- Runas命令:能让域用户/普通User用户以管理员身份运行指定程序
- 判断程序是否是以 管理员 身份运行 visual c++
- Runas命令:能让域用户/普通User用户以管理员身份运行指定程序。
- C#默认以管理员身份运行程序
- Visual 2008开发程序始终以管理员身份运行程序
- C# WinForm判断Win7下程序是否以管理员身份运行
- c#程序以管理员身份运行
- C# 让程序自动以管理员身份运行
- [原创]Win7、Win8、Win10始终以管理员身份运行程序。
- BCB 用管理员身份运行程序
- 【win8管理员身份运行程序如何设置?】
- C#如何以管理员身份运行程序
- c#通过app.manifest使程序以管理员身份运行
- C++ UAC 提权 以一个管理员身份运行程序
- 如何自动以管理员身份运行.NET程序?
- 让程序在win7下运行时弹出"以管理员身份运行"
- 让程序在Win7下始终以管理员身份运行的方法(图文教程)
- [Winform]默认以管理员身份运行程序
- 检测运行在vista下的程序是否以管理员身份运行 API