小咩快跑 2019-03-05 22:23 采纳率: 0%
浏览 565

winform 在win7环境下 单独隐藏或者禁用左下角的开始菜单 保留其他

winform 在win7环境下 隐藏或者禁用左下角的开始菜单
[DllImport("user32.dll")]
public static extern bool GetCursorPos(ref Point lpPoint);

    [DllImport("user32.dll", EntryPoint = "FindWindowEx", SetLastError = true)]
    public static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow);

    [DllImport("user32.dll", EntryPoint = "ShowWindow", SetLastError = true)]
    public static extern bool ShowWindow(IntPtr hWnd, uint nCmdShow);

    public static Point GetCursorPos()
    {
        Point point = new Point();
        GetCursorPos(ref point);
        return point;
    }

    public static void HideTask(bool isHide)
    {
        try
        {
            IntPtr trayHwnd = FindWindowEx(IntPtr.Zero, IntPtr.Zero, "Shell_TrayWnd", null);
            IntPtr hStar = FindWindowEx(IntPtr.Zero, IntPtr.Zero, "Button", null);

            if (isHide)
            {
                ShowWindow(trayHwnd, 0);
                ShowWindow(hStar, 0);
            }
            else
            {
                ShowWindow(trayHwnd, 1);
                ShowWindow(hStar, 1);
            }
        }
        catch { }
    }

            这种方法会连其他任务一起消失  求有没有其他办法  小弟没分了
  • 写回答

1条回答 默认 最新

  • threenewbee 2019-03-05 23:06
    关注

    ShowWindow(trayHwnd, 0);
    这行去掉

    评论

报告相同问题?

悬赏问题

  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的
  • ¥15 r语言蛋白组学相关问题
  • ¥15 Python时间序列如何拟合疏系数模型