1
我正在嘗試創建一個程序來顯示我的Gtalk(在線/離線)狀態。GoogleTalk的查找狀態
我能找到狀態視圖2類,但我怎麼能找到其中的文本。
這是我的代碼。
API decleration:調用阿比
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern IntPtr FindWindowEx(IntPtr parentHandle, IntPtr childAfter, string lclassName, string windowTitle);
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
代碼:
IntPtr hwnd = IntPtr.Zero;
hwnd = FindWindowEx(hwnd, IntPtr.Zero, "Google Talk - Google Xmpp Client GUI Window", "Google Talk");
hwnd = FindWindowEx(hwnd, IntPtr.Zero, "Main View", "@main");
hwnd = FindWindowEx(hwnd, IntPtr.Zero, "Status View 2", "Status Box");
hwnd = FindWindowEx(hwnd, IntPtr.Zero, "RichEdit20W", "String.Empty");
MessageBox.Show(hwnd.ToString());
感謝。