当前位置:网站首页>wpf 打开外部程序并在需要时激活
wpf 打开外部程序并在需要时激活
2022-07-20 16:13:00 【ima_zhan】
打开外部程序使用Process
激活窗体,通过SetForegroundWindow函数传递Process获取的句柄激活
_external = new Process();
[DllImport("User32.dll", EntryPoint = "SetForegroundWindow")]
public static extern int SetForegroundWindow(IntPtr hWnd);
public void Run(string file, string args)
{
bool _bExisted = true;
try
{
if (_external.HasExited == false)
{
_bExisted = false;
SetForegroundWindow(_external.MainWindowHandle);
return;
}
}
catch (Exception e)
{
Global.MainLogging.LogError("ExternalProcess.Run:param1:" + file + ",param2:" + args + "," + e.ToString());
}
finally
{
if (_bExisted) RunExternal(file, args);
}
}
边栏推荐
- bug汇总
- JS-----第三章 js循环
- 【蓝桥杯基础训练】十六进制转八进制
- 李宏毅老师2020年深度学习系列讲座笔记1
- tvm安装与使用
- Apprentissage de la sécurité des réseaux (vii) IIS
- code snippet
- Tmech publishes the latest progress in the operation control technology of the must choose: to realize the high robustness walking of humanoid robots
- 李宏毅老师2020年深度学习系列讲座笔记2
- 展锐虎贲T310详解:首次将大核及DynamIQ架构引入入门级市场!
猜你喜欢
有关贝叶斯概率和贝叶斯网络和贝叶斯因果网络的自习笔记
廖雪峰老师系列课程 迅速过一遍 1
李宏毅老师2020年深度学习系列讲座笔记4
商城异地多活架构设计
李宏毅老师2020年深度学习系列讲座笔记9
李宏毅老师2020年深度学习系列讲座笔记6
2021/7/16 the first step of learning scattering Network - Introduction to neural network
2021/7/24 SVM 2021/7/26 后门学习&对抗神经网络
Hydrogen future, China hydrogen energy alliance held the launching ceremony of 2022 hydrogen energy specialty and new entrepreneurship competition
Prometheus operator configuration alarm
随机推荐
yolov5
SMS verification
For the IT Internet industry, does family think education is important or ability?
串行队列的使用
李宏毅老师2020年深度学习系列讲座笔记8
Mdclub lightweight web forum source code
Advantages of stable tripartite payment channels
BGP相关知识点
TNN笔记
CentOS 7 deploys memcached cache server
Automatically deploy py scripts
有了 screen 和 nohup 跑深度学习代码再也不用愁了 | 退出终端不会影响服务器程序代码运行
oracle使用ogg导出数据到kafka
redis集群搭建及配置优化详解
李宏毅2020机器学习深度学习笔记1+2 &&深度学习基础与实践课程笔记2
堆排序总结
21_生命周期
es6新增-iterator遍历器,for..of循环
19_ Built in instructions
JS smooth scroll to top