用API函数:Findwindow
按类查找:Shell_TrayWnd,返回的是窗体的句柄。
只要用了窗体的句柄想做什么就做什么了!
按类查找:Shell_TrayWnd,返回的是窗体的句柄。
只要用了窗体的句柄想做什么就做什么了!
解决方案 »
- 急。。。。。。。ListViwe中全选反选的问题
- c#问题,帮写一个函数实现一个小功能
- 急问关于serialPort接收到数据,处理数据的问题
- 如何去判断一个类的实例是否存在?
- 继续DataGrid问题
- 有人用过MS的PETSHOP吗?我进到要连数据库的页面就报错
- 请问如何把数据导出到excel文件中?又如何把excel文件中的数据,再导回到数据库中,谢谢了!
- winform跨线程问题
- 基于Socket或Tcp的文件传输
- 未在本地计算机上注册“OraOLEDB.Oracle.1”提供程序?
- C#中是否可以对XML Schema文档进行查询Xpath查询?
- “项目**需要策略管理,请在Visual studio .net企业级开发版或**打开"是什么意思?
public static extern IntPtr FindWindow (
string lpClassName,
string lpWindowName
);
[DllImport("user32.dll", EntryPoint="ShowWindow")]
public static extern int ShowWindow (
IntPtr hwnd,
int nCmdShow
);
[DllImport("user32.dll", EntryPoint="GetWindowRect")]
public static extern int GetWindowRect (
IntPtr hwnd,
ref Rectangle lpRect
);
[DllImport("user32.dll", EntryPoint="IsWindowVisible")]
public static extern bool IsWindowVisible (
IntPtr hwnd
);
public const int SW_HIDE = 0;
public const int SW_SHOW = 5;
private void button22_Click(object sender, System.EventArgs e)
{
IntPtr hWnd = FindWindow("Shell_TrayWnd",null);
if(hWnd != IntPtr.Zero)
{
if(IsWindowVisible(hWnd))
ShowWindow(hWnd,SW_HIDE);
else
ShowWindow(hWnd,SW_SHOW);
Rectangle rect = new Rectangle(0,0,0,0);
GetWindowRect(hWnd,ref rect);
MessageBox.Show(rect.ToString());
}
}