close

image

image

   1: using System;
   2: using System.Collections.Generic;
   3: using System.ComponentModel;
   4: using System.Data;
   5: using System.Drawing;
   6: using System.Linq;
   7: using System.Text;
   8: using System.Windows.Forms;
   9: using System;
  10: using System.Runtime.InteropServices;
  11:  
  12: namespace HideTaskBarEx
  13: {
  14:  
  15:     public partial class Form1 : Form
  16:     {
  17:         [DllImport("user32.dll")]
  18:         private static extern IntPtr FindWindow(String className, String windowText);
  19:         [DllImport("user32.dll")]
  20:         private static extern Int32 ShowWindow(IntPtr hwnd, Int32 command);
  21:         private const Int32 HIDE = 0;
  22:         private const Int32 SHOW = 1;
  23:         public Form1()
  24:         {
  25:             InitializeComponent();
  26:         }
  27:  
  28:         private void button1_Click(object sender, EventArgs e)
  29:         {
  30:             IntPtr TaskBar = FindWindow("Shell_TrayWnd", "");
  31:             ShowWindow(TaskBar, HIDE);
  32:         }
  33:  
  34:         private void button2_Click(object sender, System.EventArgs e)
  35:         {
  36:             IntPtr TaskBar = FindWindow("Shell_TrayWnd", "");
  37:             ShowWindow(TaskBar, SHOW);
  38:         }
  39:     }
  40: }

參考資料:
  1. C# 程式碼直接呼叫 Unmanaged 程式碼的方法
  2. [C#][WinForm]如何控制工作列



arrow
arrow
    全站熱搜
    創作者介紹
    創作者 me1237guy 的頭像
    me1237guy

    天天向上

    me1237guy 發表在 痞客邦 留言(0) 人氣()