日期:2014-05-17 浏览次数:21214 次
private void Button_Click_1(object sender, RoutedEventArgs e)
{
richHandle = IntPtr.Zero;
EnumWindows(EnumFunc, 0);
if (richHandle == IntPtr.Zero)
return;
Console.WriteLine(Process_ReadRichEditText(richHandle));
}
public bool EnumFunc(IntPtr hwnd, int lParam)
{
if (!IsWindowVisible(hwnd))
return true; // 不可见
StringBuilder vBuffer = new StringBuilder(256);
GetClassName(hwnd, vBuffer, vBuffer.Capacity);
string name = vBuffer.ToString();
if (vBuffer.ToString() == "TXGuiFoundation")
{
uint vProcessId;
GetWindowThreadProcessId(hwnd, out vProcessId);
var nameid = GetProcessName(vProcessId).ToLower();
if (GetProcessName(vProcessId).ToLower() == "qq.exe")
{
GetWindowText(hwnd, vBuffer, vBuffer.Capacity);
// 标题中含"聊天中"
if (vBuffer.ToString().IndexOf("杜老师") >= 0)
{
//在这里应该是要找这个窗体里面的控件才对啊?为什么这里是枚举他的子窗口?
//还有他这里不会进入@EnumChild方法,我想是因为他找不到这个子窗口的原因?
//那这里怎么来枚举这个窗体的所有控件呢?
&