c# - 使用 WinAPI 在 C# 中从任务栏隐藏窗口

标签 c# .net winapi window taskbar

请相信我,我已经用 Google 搜索过它并希望它很容易找到 - 事实证明并非如此。 我有窗口句柄,但没有窗体。我该怎么做? 谢谢!

最佳答案

声明这些:

 [DllImport("user32.dll", SetLastError = true)]
static extern int GetWindowLong(IntPtr hWnd, int nIndex);
[DllImport("user32.dll")]
static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
private const int GWL_EX_STYLE = -20;
private const int WS_EX_APPWINDOW = 0x00040000, WS_EX_TOOLWINDOW = 0x00000080;

然后在显示表单之前使用它:


SetWindowLong(handle, GWL_EX_STYLE, (GetWindowLong(handle, GWL_EX_STYLE) | WS_EX_TOOLWINDOW) & ~WS_EX_APPWINDOW);

(将句柄更改为存储窗口句柄的任何内容)

关于c# - 使用 WinAPI 在 C# 中从任务栏隐藏窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3260757/

相关文章:

c# - 在 JavaScript 中将 C# .NET DateTime.ticks 转换为天/小时/分钟

listview - Win32 虚拟 ListView : Cannot select full row

.net - 是否可以在 Grid RowDefinitions 上使用触发器?

c# - Web API 中损坏的路由/操作

c# - 如何更改 LongListMultiSelector 中的复选框和复选框勾选的颜色? WP8

c# - 在操作结果中将 EditorTemplate 作为 PartialView 返回

c# - 如何将 yahoo 登录集成到我的应用程序中?

python - Windows 7/Vista 进程管理 - 如何在长时间空闲后启动外部程序?

c++ - 如何将 Windows 资源管理器与 Windows 命令提示符同步?

c# - 不直接从 UserControl 派生的 WPF UserControl