如何用.net编程隐藏另一个正在运行的应用程序的窗口   比如说迅雷

解决方案 »

  1.   

    Form属性中ShowinTaskbar设置
    系统托盘也是可以设置的
      

  2.   

    Form属性中ShowinTaskbar设置 
      

  3.   


    using System.Runtime.InteropServices;
      const int SW_HIDE = 0;
            const int SW_SHOWNORMAL = 1;
            const int SW_SHOWMINIMIZED = 2;
            const int SW_SHOWMAXIMIZED = 3;        [DllImport("User32.dll")]
            public static extern bool ShowWindow(IntPtr HWND, int MSG);
            [DllImport("User32.dll")]
            public static extern IntPtr FindWindow(string ClassN, string WindN);private void button1_Click(object sender, EventArgs e)
            {
                ShowWindow(FindWindow(null, "迅雷5"), SW_HIDE);//隐藏
            }        private void button2_Click(object sender, EventArgs e)
            {
                ShowWindow(FindWindow(null, "迅雷5"), SW_SHOWNORMAL);//显示
            }
      

  4.   

    恩 我测试 是用文本文件测试的  要隐藏迅雷那样的NotifyIcon,可以查一下Shell_NotifyIcon这个API 
      

  5.   

    拿到迅雷的窗体句柄后,ShowWindow
      

  6.   

    private const int SW_HIDE = 0x00;  
    private const int SW_SHOW = 0x0001;  
     
    [DllImport("coredll.dll", CharSet=CharSet.Auto)]  
    private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);  
     
    [DllImport("coredll.dll", CharSet=CharSet.Auto)]  
    private static extern bool ShowWindow(IntPtr hwnd, int nCmdShow);  
     
    [DllImport("coredll.dll", CharSet=CharSet.Auto)]  
    private static extern bool EnableWindow(IntPtr hwnd, bool enabled); 
     
    public static void Show() 

       IntPtr h = FindWindow("", "");  
       ShowWindow(h, SW_SHOW);    

     
    public static void Hide() 

       IntPtr h = FindWindow("", "");  
       ShowWindow(h, SW_HIDE);  
    }
      

  7.   

    以前写过隐藏任务栏图标的,网上应该有C#源码的也是findwindows,然后发送消息。