当前位置:网站首页>C # use winexec to call exe program
C # use winexec to call exe program
2022-06-29 10:26:00 【zlbcdn】
Realization
1、 Add reference
using System.Runtime.InteropServices;// Call external DLL2、 Definition win32API
// call exe
[DllImport("kernel32.dll")]
public static extern int WinExec(string exeName, int operType);
// Generate execution data
private void generateExecuteData_ItemClick(object sender, ItemClickEventArgs e)
{
WinExec(@"C:\ExecuteRecords\OrdersExecutionRecords.exe", 5);
}WinExec explain
1、 Return value of method .
Method success , return >31 The integer value ;
Method failed , return :
| Return results | explain |
|---|---|
| 0 | Insufficient system memory or resources |
| ERROR_BAD_FORMAT | Illegal exe Program |
| ERROR_FILE_NOT_FOUND | File not found |
| ERROR_PATH_NOT_FOUND | path not found |
2、 Parameters
Method has two parameters : The first parameter lpCmdLine Is the path + Program 、 The second parameter nCmdShow For presentation .
2.1lpCmdLine
Search order :
1、 Parameter to specify the path
2、 Application path
3、 current path
4、system route ( Callable GetSystemDirectory Method query )
5、window route ( Callable GetWindowsDirectory Method query )
6、 In the environment variables path route
2.2uCmdShow
The details are as follows
| Parameters | explain |
|---|---|
| 11 | Minimize forms |
| 0 | The form is hidden |
| 3 | Maximize form |
| 6 | After minimizing the form , Activate Z The upper window on the axis |
| 9 | Reinitialize the form |
| 5 | Show form |
| 10 | |
| 3 | Activate forms , And maximize it |
| 2 | Activate forms , And minimize |
| 7 | Show form , And set to minimize |
| 8 | The size and position of the display form is the current size and position |
| 4 | The size and position of the display form is the most commonly used size and position |
| 1 | Activate and display a form . Whether the form is minimized or maximized , The system restores it to its original size and location . When first used , This value is recommended |
边栏推荐
- 2019.11.13 training summary
- 2019.10.16训练总结
- Codeforces Round #641 Div2
- September 21, 2020 referer string segmentation boost gateway code organization level
- Use of Azkaban in task scheduler
- 520 diamond Championship 2021
- 走迷宫 bfs 中等+——最后的编程挑战
- C#中Linq常用用法
- Summary after the 2009 ICPC Shanghai regional competition
- Is it safe to open a stock account with the QR code given by the manager of a securities firm? I want to open an account
猜你喜欢
随机推荐
Analyze in detail the PBOT mining virus family behavior and the principle of exploited vulnerabilities, and provide detailed protection suggestions for the blue army
Codeforces Round #659 (Div. 2)
To 3 -- the last programming challenge
Web漏洞手动检测分析
mysql 8.0 一条insert语句的具体执行流程分析(三)
MySQL中的alter table操作之add/modify/drop列
Codeforces Round #641 Div2
Beautiful ruins around Kiev -- a safe guide to Chernobyl!
Nacos registry cluster
September 21, 2020 referer string segmentation boost gateway code organization level
nacos注册中心集群
The Stones Game【取石子博弈 & 思维】
mysql中的if [not] exists
Codeforces Round #657 Div. 2
Analysis of liferayportal jsonws deserialization vulnerability (cve-2020-7961)
同花顺炒股软件可靠吗,安全吗?
云主机端口扫描
EDA与VHDL题库
《CLR via C#》读书笔记-加载与AppDomain
Codeforces - 1151b thinking









