We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5e8f49d commit a87a136Copy full SHA for a87a136
Process/ShellExecute.rs
@@ -0,0 +1,29 @@
1
+extern crate winapi;
2
+
3
+// MSDN For ShellExecute : https://learn.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-shellexecutea
4
+use winapi::um::{winuser::SW_SHOWNORMAL,
5
+ shellapi::ShellExecuteA};
6
+use std::ptr;
7
+use std::ffi::CString;
8
+use winapi::shared::ntdef::NULL;
9
10
+fn main() {
11
+ let command = CString::new("calc.exe").unwrap();
12
+ let verb = CString::new("runas").unwrap();
13
14
+ // For Folder ..
15
+ // let parameters = CString::new("").unwrap();
16
+ // let directory = CString::new("").unwrap();
17
+ let dirc = NULL as _;
18
19
+ unsafe {
20
+ ShellExecuteA(
21
+ ptr::null_mut(),
22
+ verb.as_ptr(),
23
+ command.as_ptr(),
24
+ dirc,
25
26
+ SW_SHOWNORMAL,
27
+ );
28
+ }
29
+}
0 commit comments