【问题标题】:Hiding window from taskbar in C# with WinAPI使用 WinAPI 在 C# 中从任务栏隐藏窗口
【发布时间】:2011-03-16 16:51:09
【问题描述】:

相信我,我在 Google 上搜索过它,并认为它会很容易找到 - 但事实并非如此。 我有我的窗把手,但没有表格。我该怎么做? 谢谢!

【问题讨论】:

    标签: c# .net winapi window taskbar


    【解决方案1】:

    将 Form 的 ShowInTaskbar 属性设置为 false。

    【讨论】:

    • 使用 WinAPI,而不是 .NET 属性。
    【解决方案2】:

    声明这些:

     [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);
    

    (将句柄更改为您存储的窗口句柄)

    【讨论】:

      猜你喜欢
      • 2015-12-18
      • 2017-05-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-02-22
      • 1970-01-01
      • 2010-11-18
      相关资源
      最近更新 更多