C#隐藏桌面图标

  


private void ShowDeskIcon(bool b)//控制桌面图标显隐
{             
  IntPtr desk = FindWindow("ProgMan", null);//获取桌面句柄
  IntPtr list_ = FindWindowEx(desk, 0, "SHELLDLL_DefView", null);//获取上级句柄
  IntPtr Idesk = FindWindowEx(list_, 0, "SysListView32", "FolderView"); //获取桌面 

  //图标列表句柄,list_为上级父句柄值,用 精易编程助手 查询          
  int value = 0;
  if (b == true)
  {
     value = 5;
   }
  ShowWindow(Idesk, value);  //value=5时显示,value=0时隐藏
}        


 

你可能感兴趣的:(c#,winform)