.ENT 实现隐藏Windows 任务栏

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        [DllImport("User32.dll ")]
        public static extern IntPtr FindWindowEx(IntPtr ph, IntPtr ch, String cn, String wn);
        [DllImport("User32.dll ")]
        public static extern bool ShowWindow(IntPtr hWnd, long nCmdShow);
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            IntPtr handle = FindWindowEx(IntPtr.Zero, IntPtr.Zero, "Shell_TrayWnd", null);
            ShowWindow(handle, 0);

        }

        private void button2_Click(object sender, EventArgs e)
        {
            IntPtr handle = FindWindowEx(IntPtr.Zero, IntPtr.Zero, "Shell_TrayWnd", null);
            ShowWindow(handle, 1);
        }
    }
}

posted @ 2012-01-30 16:53  晴天有时下鱼  阅读(151)  评论(0编辑  收藏  举报