C++ 从“用户帐户控制”对话框中获取返回值
我不确定这是否可能,但如果可能的话,我想知道怎么做。使用ShellExecute()可以执行命令和打开东西,因此我决定以管理员身份用这段代码打开C++ 从“用户帐户控制”对话框中获取返回值,c++,c,windows,user-accounts,C++,C,Windows,User Accounts,我不确定这是否可能,但如果可能的话,我想知道怎么做。使用ShellExecute()可以执行命令和打开东西,因此我决定以管理员身份用这段代码打开cmd.exe ShellExecute(0, "runas", "cmd.exe", command, 0, SW_HIDE); // command being a cmd line command // now it works okay, it runs cmd as administrator, i want to get the ret
cmd.exe
ShellExecute(0, "runas", "cmd.exe", command, 0, SW_HIDE); // command being a cmd line command
// now it works okay, it runs cmd as administrator, i want to get the return value
// of the UAC 'yes' or 'no' option.ie.
// in pseudo code
if( UAC == NO ) // do something
else // do something else
是否可以使用C/C++编写类似的代码?我认为使用ShellExecuteEx更好,因为它可以为您提供有关创建过程的更多信息。如果用户拒绝提升提示,我想你会得到一个错误代码。我会检查它。谢谢