Sign in to follow this  
Followers 0

Possible to manipulate a Skype TChatContentControl?

4 posts in this topic

#1 ·  Posted

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.


My pride and joy. MrAutoIt.com and Blog.MrAutoIt.com. It has AutoIt tutorials, skill tests and a section for those who just want to hire a freelance AutoIt programmer.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

#3 ·  Posted

Thanks LaCastiglione.

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


My pride and joy. MrAutoIt.com and Blog.MrAutoIt.com. It has AutoIt tutorials, skill tests and a section for those who just want to hire a freelance AutoIt programmer.

Share this post


Link to post
Share on other sites

#4 ·  Posted

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.


GeorgeQuestion about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else."Old age and treachery will always overcome youth and skill!"

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