Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/142.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/58.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 从“用户帐户控制”对话框中获取返回值_C++_C_Windows_User Accounts - Fatal编程技术网

C++ 从“用户帐户控制”对话框中获取返回值

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

我不确定这是否可能,但如果可能的话,我想知道怎么做。使用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 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更好,因为它可以为您提供有关创建过程的更多信息。如果用户拒绝提升提示,我想你会得到一个错误代码。我会检查它。谢谢