惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Visual Studio Blog
爱范儿
爱范儿
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
雷峰网
雷峰网
V
V2EX
博客园_首页
Engineering at Meta
Engineering at Meta
博客园 - 聂微东
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Apple Machine Learning Research
Apple Machine Learning Research
GbyAI
GbyAI
H
Help Net Security
A
About on SuperTechFans
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Blog — PlanetScale
Blog — PlanetScale
W
WeLiveSecurity
云风的 BLOG
云风的 BLOG
D
Docker
Security Archives - TechRepublic
Security Archives - TechRepublic
Help Net Security
Help Net Security
N
News and Events Feed by Topic
Simon Willison's Weblog
Simon Willison's Weblog
G
Google Developers Blog
A
Arctic Wolf
T
The Blog of Author Tim Ferriss
博客园 - 叶小钗
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Google DeepMind News
Google DeepMind News
博客园 - 三生石上(FineUI控件)
aimingoo的专栏
aimingoo的专栏
Hacker News: Ask HN
Hacker News: Ask HN
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - 司徒正美
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
P
Privacy International News Feed
T
Troy Hunt's Blog
T
Tenable Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Recorded Future
Recorded Future
F
Fortinet All Blogs
D
DataBreaches.Net
B
Blog
T
Threat Research - Cisco Blogs
MyScale Blog
MyScale Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
The GitHub Blog
The GitHub Blog
Security Latest
Security Latest
M
MIT News - Artificial intelligence

博客园 - 太阳底下淋雨

amd显卡的问题 防止WindowChrome控件遮挡下面的控件 win11右键子菜单展开增加延时 [转]Git清除贡献者信息和历史提交记录,将开源项目拉取二次开发时可用到 判断是否为隐藏文件 快速查询python项目使用了哪些第三方库 C#删除路径到回收站 C#操作超长路径文件时异常的处理 win11使用传统右键菜单 WPF中自定义按钮实现最大化最小化动画过度效果 Excel文件中嵌入自定义功能区customUI.xml文件后,如何进行修改 Excel中得到合并单元格的信息 WPF中文字发虚的问题解决 文件没有读取权限造成的File.Exists结果为false js如何判断当前页面是否处于激活状态 WinForm使用发布方式进行安装的安装目录 SqlServer使用row_number()分页 EF强类型查询本身部分字段时的处理 Dapper实现Like参数化
winform恢复窗口前端显示
太阳底下淋雨 · 2018-02-05 · via 博客园 - 太阳底下淋雨

1.添加系统DLL引用

[DllImport("user32.dll")]
public static extern void SwitchToThisWindow(IntPtr hWnd, bool fAltTab);

2.得到窗口句柄

应用程序运行时

Process instance = null;
Process current = Process.GetCurrentProcess(); Process[] processes = Process.GetProcessesByName(current.ProcessName); //遍历与当前进程名称相同的进程列表 foreach (Process process in processes) {   //如果实例已经存在则忽略当前进程   if (process.Id != current.Id)   {     //得到已经存在的进程     instance = process;
    break;
  }
}

应用程序运行中

Process instance = Process.GetCurrentProcess();

3.调用API

SwitchToThisWindow(instance.MainWindowHandle, true);

也可以使用SetForegroundWindow接口实现

[DllImport("user32.dll")]
public static extern bool SetForegroundWindow(IntPtr hWnd);

//需要窗口的显示状态Visible=true
SetForegroundWindow(new IntPtr(window.Hwnd));
//SetForegroundWindow(window.Handle);