using System;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace WinApi
{
    
public partial class Form1 : Form
    {
        
public Form1()
        {
            InitializeComponent();
        }

        [DllImport(
"user32.dll", EntryPoint = "FindWindowA")]
        
public static extern IntPtr FindWindowA(string lp1, string lp2);
        [DllImport(
"user32.dll", EntryPoint = "ShowWindow")]
        
public static extern IntPtr ShowWindow(IntPtr hWnd, int _value);
        
//获取任务栏
        IntPtr hTray = Form1.FindWindowA("Shell_TrayWnd", String.Empty);

        
private void btnShow_Click(object sender, EventArgs e)
        {
            ShowWindow(hTray,
1);
        }

        
private void btnHide_Click(object sender, EventArgs e)
        {
          ShowWindow(hTray, 
0);
        }
    }
}
 posted on 2008-07-28 18:02  向左、  阅读(509)  评论(0编辑  收藏  举报