RT
解决方案 »
- 水晶报表问题啊~rystaldecisions.crystalreports.engine
- 用TcpClient建立连接,断开网线时,大约几秒钟才能报错,如何缩短时间?
- 设计编程语言,你会怎么做?这次讨论具体一些内容。
- 如何用C#实现发送带附件的邮件???
- 怎么让LOAD事件重新执行一次.
- vs2005,如何在安装程序中可以对ftp进行配置
- 用WinForm做一个网络硬盘本人实在搞不定,请各位前辈帮忙
- 为什么在VS2003 C#看不到错误(或异常)对话框?
- 类类类类类类类类类的问题,请高手高手高高手帮忙!
- 有做过C#智能设备编程的吗?
- 高分请教截屏幕到bmp图片问题?关于24位
- vc++.net创建activeX控件
--------------------------------------------------------------
程序,犹如人生。
private static extern int GetWindowText(HandleRef hWnd, StringBuilder lpString, int nMaxCount);
[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern int GetWindowTextLength(HandleRef hWnd);
[DllImport("user32.dll", CharSet=CharSet.Auto, SetLastError=true)]
private static extern bool EnumWindows(EnumThreadWindowsCallback callback, IntPtr extraData);
[DllImport("user32.dll", ExactSpelling = true)]
private static extern bool EnumChildWindows(HandleRef hwndParent, EnumChildrenCallback lpEnumFunc, HandleRef lParam);
private delegate bool EnumThreadWindowsCallback(IntPtr hWnd, IntPtr lParam);
private delegate bool EnumChildrenCallback(IntPtr hwnd, IntPtr lParam);private void button1_Click(object sender, EventArgs e)
{
EnumThreadWindowsCallback callback1 = new EnumThreadWindowsCallback(this.EnumWindowsCallback);
EnumWindows(callback1, IntPtr.Zero);
}
private bool EnumWindowsCallback(IntPtr handle, IntPtr extraParameter)
{
int num1 = GetWindowTextLength(new HandleRef(this, handle)) * 2;
StringBuilder builder1 = new StringBuilder(num1);
GetWindowText(new HandleRef(this, handle), builder1, builder1.Capacity);
System.Console.WriteLine(string.Format("Wnd:{0} Title: {1}", handle,builder1.ToString())); EnumChildWindows(new HandleRef(this, handle), new EnumChildrenCallback(EnumChildWindowsCallback), new HandleRef(null, IntPtr.Zero));
return true;
}
private bool EnumChildWindowsCallback(IntPtr handle, IntPtr lparam)
{
int num1 = GetWindowTextLength(new HandleRef(this, handle)) * 2;
StringBuilder builder1 = new StringBuilder(num1);
GetWindowText(new HandleRef(this, handle), builder1, builder1.Capacity);
System.Console.WriteLine(string.Format("\tSubWnd:{0} Title: {1}", handle, builder1.ToString()));
return true;
}