如何用.net编程隐藏另一个正在运行的应用程序的窗口 比如说迅雷
解决方案 »
- 通过kernel32.dll调用动态库调时第一个接口函数能成功,第二个时“无法加载 DLL“kernel32.dll”
- WVC 实体模型不知道你们遇到过没有
- C#中,格式化向txt文件写入一个固定宽度的字符串,不够的用$代替,怎么实现啊?
- 要一个正则表达式。
- 错误 1 验证 (Internet Explorer 6): 元素“p”不能嵌套在元素“table”中,问题
- C#中以共享方式打开Excel
- winform 中的treeview如何绑定大量数据库?求完整代码
- 请教关于错误如何处理问题,谢谢
- 散分
- 很想知道这些代码在哪里可以输入并编译运行
- int变量未赋值可以使用?
- excel转换xml的细节问题
系统托盘也是可以设置的
using System.Runtime.InteropServices;
const int SW_HIDE = 0;
const int SW_SHOWNORMAL = 1;
const int SW_SHOWMINIMIZED = 2;
const int SW_SHOWMAXIMIZED = 3; [DllImport("User32.dll")]
public static extern bool ShowWindow(IntPtr HWND, int MSG);
[DllImport("User32.dll")]
public static extern IntPtr FindWindow(string ClassN, string WindN);private void button1_Click(object sender, EventArgs e)
{
ShowWindow(FindWindow(null, "迅雷5"), SW_HIDE);//隐藏
} private void button2_Click(object sender, EventArgs e)
{
ShowWindow(FindWindow(null, "迅雷5"), SW_SHOWNORMAL);//显示
}
private const int SW_SHOW = 0x0001;
[DllImport("coredll.dll", CharSet=CharSet.Auto)]
private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("coredll.dll", CharSet=CharSet.Auto)]
private static extern bool ShowWindow(IntPtr hwnd, int nCmdShow);
[DllImport("coredll.dll", CharSet=CharSet.Auto)]
private static extern bool EnableWindow(IntPtr hwnd, bool enabled);
public static void Show()
{
IntPtr h = FindWindow("", "");
ShowWindow(h, SW_SHOW);
}
public static void Hide()
{
IntPtr h = FindWindow("", "");
ShowWindow(h, SW_HIDE);
}