• Announcements

Sign in to follow this  
Followers 0

Possible to manipulate a Skype TChatContentControl?

4 posts in this topic

Posted · Report post

I am playing around with Skype and I wanted to see if I could write a small program that would filter incoming and outgoing messages but I am not aware of anyway to interact with a TChatContentControl.

Share this post


Link to post
Share on other sites



Posted (edited) · Report post

Check out this page. I don't have Skype so I haven't tried it.

Edit: Ok, try this code and see what it does. Keep in mind that I don't have Skype so I'm coding blindly here:


Edit: I didn't actually code this. I just converted it to AutoIt.

#include <WinAPI.au3>

Global Const $IID_IAccessible = DllStructCreate("long lData1; integer nData2; integer nData3; byte abytData4[8]")

DllStructSetData($IID_IAccessible, 1, 0x618736E0)
DllStructSetData($IID_IAccessible, 2, 0x3C3D)
DllStructSetData($IID_IAccessible, 3, 0x11CF)
DllStructSetData($IID_IAccessible, 4, 0x81, 1)
DllStructSetData($IID_IAccessible, 4, 0xC, 2)
DllStructSetData($IID_IAccessible, 4, 0x0, 3)
DllStructSetData($IID_IAccessible, 4, 0xAA, 4)
DllStructSetData($IID_IAccessible, 4, 0x0, 5)
DllStructSetData($IID_IAccessible, 4, 0x38, 6)
DllStructSetData($IID_IAccessible, 4, 0x9B, 7)
DllStructSetData($IID_IAccessible, 4, 0x71, 8)

EnumHistory()

Func FindWindowEx($parent, $child, $class)
	DllCall("User32.dll", "hwnd", "FindWindowEx", "hwnd", $parent, "hwnd", $child, "str", $class, "str", '')
EndFunc   ;==>FindWindowEx

Func AccessibleObjectFromWindow($hWnd, $obj_id, $riid, ByRef $obj)
	Local Const $result = DllCall("Oleacc.dll", "integer", "AccessibleObjectFromWindow", "hwnd", $hWnd, "dword", $obj_id, "integer", $riid, "ptr", $obj)

	If IsArray($result) Then
		Return $result[0]
	Else
		Return 0
	EndIf
EndFunc   ;==>AccessibleObjectFromWindow

Func AccessibleChildren($cont, $child_start, $children, ByRef $var_children, ByRef $obtained)
	Local Const $result = DllCall("Oleacc.dll", "integer", "AccessibleChildren", "ptr", $cont, "long", $child_start, "long", $children, "ptr", $var_children, "long", $obtained)

	If IsArray($result) Then
		Return $result[0]
	Else
		Return 0
	EndIf
EndFunc

Func EnumHistory()
	Local $hWnd = FindWindowEx(0, 0, "TskMultiChatForm.UnicodeClass")
	Local $hr = "HRESULT"
	Local $childCount
	Local $WindowObject
	Local $accChildren
	Local $nReceived
	Local Const $OBJID_CLIENT = 0xFFFFFFFC

	If $hWnd <> 0 Then
		$hWnd = FindWindowEx($hWnd, 0, "TChatBackground")

		If $hWnd <> 0 Then
			$hWnd = FindWindowEx($hWnd, 0, "TPanel")

			If $hWnd <> 0 Then
				$hWnd = FindWindowEx($hWnd, 0, "TPanel")

				If $hWnd <> 0 Then
					$hWnd = FindWindowEx($hWnd, 0, "TChatContentControl")

					If $hWnd <> 0 Then
						$hr = AccessibleObjectFromWindow($hWnd, $OBJID_CLIENT, $IID_IAccessible, $WindowObject)

						If $hr >= 0 Then
							$childCount = $WindowObject.accChildCount
							ReDim $accChildren[$childCount - 1]

							If $childCount > 0 Then
								$hr = AccessibleChildren($WindowObject, 0, $childCount, $accChildren[0], $nReceived)

								If $hr >= 0 Then
									For $i = 0 To $nReceived - 1
;~ 										If TypeOf $accChildren($i) Is IAccessible Then
										ConsoleWrite("Found object: " & $accChildren($i).accName(0) & @LF)
;~ 										Else
										ConsoleWrite("Found object:" & $WindowObject.accName($accChildren($i)) & @LF & @LF)
;~ 										EndIf
									Next
								Else
									ConsoleWrite("Accessible Chilren failed with code: " & $hr & @LF)
								EndIf
							EndIf
						Else
							ConsoleWrite("AccessibleObjectFromWindow failed with code: " & $hr & @LF)
						EndIf
					Else
						ConsoleWrite("Could not find TChatContentControl" & @LF)
					EndIf
				Else
					ConsoleWrite("Could not find TPanel #2" & @LF)
				EndIf
			Else
				ConsoleWrite("Could not find TPanel #1" & @LF)
			EndIf
		Else
			ConsoleWrite("Could not find the TChatBackground class" & @LF)
		EndIf
	Else
		ConsoleWrite("Could not find a chat window" & @LF)
	EndIf
EndFunc   ;==>EnumHistory
Edited by LaCastiglione

Share this post


Link to post
Share on other sites

Posted · Report post

Thanks LaCastiglione.

Unfortunately it returns a “Could not find a chat window” massage.

Share this post


Link to post
Share on other sites

Posted · Report post

You may have a problem with this. If I'm not mistaken Skype was written in Delphi and there are times when it's near impossible to get decent results when trying to automate anything to do with Delphi windows or controls.
Of course now that Microsoft owns Skype that may all change in the not too distant future.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.