matty
Scripting Guru
Posts: 8336 Reputation: 109
39 / /
Joined: Dec 2002
Status: Away
|
RE: MSNCrypt Encryption Plugin
quote: Originally posted by RooJ
ne of matty's projects read from the conversation window and in turn could also be changed to write to it. The only problem is it works on a point and click basis, im not sure how to locate the childwindow through code as the api ive tried came up empty.
Declarations:
code: Public Declare Function FindWindowExA Lib "user32.dll" (ByVal hWnd1 As Long, _
ByVal hwnd2 As Long, _
ByVal lpsz1 As String, _
ByVal lpsz2 As String) _
As Long
Public Declare Sub AccessibleObjectFromWindow Lib "OLEACC.dll" (ByVal hwnd As Long, _
ByVal dwId As Long, _
ByRef riid As Guid, _
ByRef ppvObject As Object)
Public Declare Function AccessibleChildren Lib "oleacc" (ByVal paccContainer As IAccessible, _
ByVal iChildStart As Long, _
ByVal cChildren As Long, _
rgvarChildren As Variant, _
pcObtained As Long) _
As Long
Public Const CHILDID_SELF As Long = 0
Public Const CHILDID_1 As Long = 1
Public Const OBJID_CLIENT As Long = &HFFFFFFFC
Public IID_IAccessible As Guid
Public Type Guid
Data1 As Long
Data2 As Integer
Data3 As Integer
Data4(0 To 7) As Byte
End Type
Public Const NAVDIR_NEXT As Long = 5
Public Const NAVDIR_FIRSTCHILD As Long = 7
ParseCommand Function:
code: Public Function ParseCommand(ByVal sCommand As String, _
ByVal sCommandArg As String, _
ByVal oConversationWnd As Object, _
ByRef sResult As String) _
As Boolean
Dim ConversationWnd_Obj As Object
Dim lngTMP As IAccessible
Dim iTMP As IAccessible
Dim lngTMP2 As Long
Dim lngCount As Long
Dim accChildren() As Variant
Set ConversationWnd_Obj = oConversationWnd
Select Case LCase(sCommand)
Case Is = "/xtest" '//Change to whatever you want your command to be
Call AccessibleObjectFromWindow(FindWindowExA(ConversationWnd_Obj.hwnd, _
0, _
"DirectUIHWND", _
vbNullString), _
OBJID_CLIENT, _
IID_IAccessible, _
lngTMP)
If Not lngTMP Is Nothing Then
Set iTMP = lngTMP.accParent
ReDim accChildren(lngCount - 1)
Call AccessibleChildren(iTMP, 0, iTMP.accChildCount - 1, accChildren(0), lngTMP2)
For lngCount = 0 To iTMP.accChildCount - 1
DoEvents
If accChildren(lngCount).accName(CHILDID_SELF) = "Input" Then
accChildren(lngCount).accValue(CHILDID_SELF) = "You see this so you know it's working!"
Exit For
End If
Next
End If
Set ConversationWnd_Obj = Nothing
sResult = ""
ParseCommand = True
Exit Function
End Select
ParseCommand = False
End Function
This post was edited on 11-28-2005 at 05:37 AM by matty.
|
|