Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I'm trying to read text out of google talks chat window, but I can't seem to figure out how. This is my current code:

 

[DllImport("user32.dll",EntryPoint="FindWindow")]
	public static extern int FindWindow(string _ClassName, string _WindowName);
	[DllImport("user32.dll",EntryPoint="FindWindowEx")]
	public static extern int FindWindowEx(int hWnd1, int hWnd2, string lpsz1, int lpsz2);
	[DllImport("user32.dll",EntryPoint="SendMessage")]
	public static extern int SendMessage(int _WindowHandler, int _WM_USER, int _data, int _id);
	[DllImport("user32.dll",EntryPoint="SendMessage")]
	public static extern int SendMessage(int _WindowHandler, int _WM_USER, int _data, string _id);
	[DllImport("User32.dll")]
	public static extern bool SetForegroundWindow(int hWnd);

public void GetText()
	{
		int Handler = FindWindow("Chat View",null);
		if (Handler > 0)
		{
			int Alt = FindWindowEx(Handler, 0, "AtlAxWin71", 0);
			if(Alt > 0)
			{
				int IES = FindWindowEx(Alt, 0, "Internet Explorer_Server", 0);
				if(IES > 0)
				{
					MessageBox.Show(SendMessage(IES, (int) WMDefs.WM_GETTEXTLENGTH, 0, 0).ToString());
					SetForegroundWindow(Handler);
				}
				else
				{
					MessageBox.Show("Cannot find IES");
				}
			}
			else
			{
				MessageBox.Show("Cannot find alt");
			}
		}
		else
		{
			MessageBox.Show("A Google Talk chat window is not open","Error",MessageBoxButtons.OK,MessageBoxIcon.Error);
		}
	}

 

The text length is 0. Is there a way to get the text out of the chat window?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...