Closed fanchenio closed 1 year ago
Here's a simpler approach:
use windows::{
w, Win32::UI::{WindowsAndMessaging::SW_SHOWDEFAULT, Shell::ShellExecuteW},
};
fn main() {
unsafe {
ShellExecuteW(
None,
w!("runas"),
w!("D:\\Program Files\\Tencent\\QQMusic\\QQMusic1944.11.24.29\\QQMusic.exe"),
None,
w!("D:\\Program Files\\Tencent\\QQMusic\\QQMusic1944.11.24.29"),
SW_SHOWDEFAULT,
);
}
}
My code
Under normal circumstances, a window should pop up asking whether to start it as an administrator, but it did not pop up, but the application was opened directly. What is the problem?