用API函数:Findwindow
按类查找:Shell_TrayWnd,返回的是窗体的句柄。
只要用了窗体的句柄想做什么就做什么了!
按类查找:Shell_TrayWnd,返回的是窗体的句柄。
只要用了窗体的句柄想做什么就做什么了!
解决方案 »
- 如何找到哪个文件的什么地方引用了程序集??
- c#编写一个连续循环读取BIN文件(不是BIN文件内部内容是这个格式的文件均要被读)的程序???????????????????????????????????
- sqlconnection只能用一次?
- 求一些有大量C#Sockek,MySQL数据库等方面知识文章的Blog或网站。谢谢
- 调用存储过程出现ora:01036错误
- 求C#设计手册一书
- 这么问题杂没人回复我啊.是不是太简单了
- C# 里关于'结构'的问题
- 各位大拿!!!问个关于主窗体调用子窗体的问题!!
- 错误的完全描述,希望大家帮忙,1935错误
- 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());
}
}