打印

[asp.net教程] 通过win32api让c#控制windows任务栏

通过win32api让c#控制windows任务栏

如果你要在你的c#程序中控制windows的任务栏,有两个windows api 可以帮到你!他们就是 findwindowa 和 showwindow
   
  c#中声明如下:
   
  using system.runtime.interopservices;
   
  [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);
   
  其实windows的任务栏就是一个特殊的窗口,所以操作窗口的方法,对任务栏一样适合!控制代码如下:

   
  //获取任务栏
  intptr htray = form1.findwindowa("shell_traywnd", string.empty);
   
  //显示任务栏
  form1.showwindow(htray, 5);
   
  //隐藏任务栏
  form1.showwindow(htray, 0);

TOP

返回顶部
AYBlue

Processed in 0.050240 second(s), 7 queries.

当前时区 GMT+8, 现在时间是 2009-1-10 11:42 京ICP备06054220号

清除 Cookies - 联系我们 - 163K.com - Archiver - WAP