Page 4 of 4

Re: Read DirectUIHWND class window and select item.[solved]

Posted: Tue Jun 11, 2013 5:04 pm
by luis
:)

Thank you for taking the time to write this, it's always nice to hear.

Re: Read DirectUIHWND class window and select item.[solved]

Posted: Fri Feb 06, 2015 8:48 am
by SeregaZ
google chrome have another type of this IAccess? or becouse it is old problem with:

Code: Select all

            ;
            ;*enum = *aAccessible ; this look definitely wrong, don't know how this did work in delphi
            ;         
            *enum\Reset() ; for good measure 
Image

as you can see it not read this digits items on certificate selector.

Re: Read DirectUIHWND class window and select item.[solved]

Posted: Sat Feb 07, 2015 7:42 pm
by luis
I don't have chrome installed and with all the time passed and my hate for this particular set of APIs honestly right now I don't remember anything about all this stuff !

I just remember I tried to help because of this exchange:
MachineCode wrote:Up your price. We're busy people. :)
alfa wrote:I am not have a lot of money :(. And the final program will be free.
... and that all I was able to come up with is already there.

Plus I would really like to avoid trying to understand this again :)

Re: Read DirectUIHWND class window and select item.[solved]

Posted: Sat Jul 16, 2016 4:49 pm
by doctorized
Sorry for bringing this post back to life but I am trying to write an app that will get url from the browsers. I have a code that gets the url from Firefox but not from Chrome. Can anyone help to complete the code?

Code: Select all

#CHILDID_SELF = 0
#WINEVENT_OUTOFCONTEXT = 0
#WINEVENT_SKIPOWNPROCESS = $2
#EVENT_OBJECT_FOCUS = $8005
#EVENT_OBJECT_SELECTION = $8006
#EVENT_OBJECT_VALUECHANGE = $800E
#ROLE_SYSTEM_DOCUMENT = $F
#ROLE_SYSTEM_PANE = $10
#ROLE_SYSTEM_TEXT = $2A
#ROLE_SYSTEM_CLIENT = $0A
#ROLE_SYSTEM_WINDOW	= $09
#ROLE_SYSTEM_PAGETAB	= $25

Procedure.l ASCIItoBSTR(asciiString$)
  Protected result = 0
  CompilerIf #PB_Compiler_Unicode
  result = SysAllocString_(@asciiString$)
  CompilerElse
  Protected *buff = AllocateMemory(Len(asciiString$)*2 + 2)
  If *buff
    PokeS(*buff, asciiString$, -1, #PB_Unicode)
    result = SysAllocString_(*buff)
    FreeMemory(*buff)
  EndIf
  CompilerEndIf
  ProcedureReturn result
EndProcedure

Procedure WinEventFunc(HookHandle.l, hEvent.l, hwnd.l, idObject.l, idChild.l, idEventThread.l, dwmsEventTime.l)
Protected *objectIa.IAccessible
Select hEvent
	Case #EVENT_OBJECT_FOCUS, #EVENT_OBJECT_VALUECHANGE, #EVENT_OBJECT_SELECTION
		className$ = Space(256)
		GetClassName_(hwnd, @className$, 256)
		;If LCase(className$) <> "listbox": Debug className$: EndIf
		;If className$ = "Chrome_OmniboxView" Or className$ = "Chrome_WidgetWin_0" Or className$ = "MozillaWindowClass" Or className$ = "Internet Explorer_Server" Or className$ = "OpWindow" Or className$ = "Chrome_AutocompleteEditView" Or className$ = "Chrome_XPFrame" Or FindString(className$, "WebViewWindowClass") > 0 Or className$ = "SearchableWebView"  Or className$ = "WebKitEdit" Or className$ = Space(256)
		If CallFunction(0, "AccessibleObjectFromEvent", hwnd, idObject, idChild, @*objectIa, @v.VARIANT) = #S_OK
		  ;AddGadgetItem(1,-1,"inside")
				v.VARIANT\vt = #VT_I4
				v\lVal = #CHILDID_SELF
				If *objectIa\get_accRole(v, @v) = #S_OK
				  ;AddGadgetItem(1,-1, "ins 2")
					Select v\lVal
							Case #ROLE_SYSTEM_PANE, #ROLE_SYSTEM_DOCUMENT, #ROLE_SYSTEM_TEXT, #ROLE_SYSTEM_CLIENT, #ROLE_SYSTEM_PAGETAB, #ROLE_SYSTEM_WINDOW
								v\vt = #VT_I4
								v\lVal = #CHILDID_SELF
								url$ = Space(#MAX_PATH)
								bstr = ASCIItoBSTR(Space(#MAX_PATH))
								iik = *objectIa\get_accValue(v, @bstr)
								
								If iik = #S_OK
								  AddGadgetItem(1,-1, "ins OK")
									len = WideCharToMultiByte_(#CP_ACP, 0, bstr, -1, 0, 0, 0, 0)
									url$ = Space(len)
									WideCharToMultiByte_(#CP_ACP, 0, bstr, -1, @url$, len, 0, 0) 
									;Debug "url = " + url$
									AddGadgetItem(1,-1, url$)
									If url$ <> ""
										If Left(url$,3) = "www": url$ = "http://" + url$: EndIf
										;If (Left(url$,4) = "http" Or Left(url$,3) = "ftp" Or Left(url$,3) = "www") And Len(url$) > 8
											AddGadgetItem(1,-1,"  URL TO CHECK 2 - " + url$)
											;url$ = URLEncode(url$)
											;If CheckURL(url$, className$, "<URL>") = 0
											;	CheckBody(url$, className$)
											;EndIf
										;EndIf
									EndIf
								ElseIf iik = 1
								  AddGadgetItem(1,-1, "ins 1")
									If *objectIa\get_accChildCount(@cChildren.i) = #S_OK And cChildren > 0     
										;aOffset$ + " " ; fix indenting
										;Debug aOffset$ + "Children: " + Str(count)
										AddGadgetItem(1,-1,"Children: " + Str(cChildren))
										*varChildren = AllocateMemory(cChildren*(8+2*4)) ;cChildren*(8+2*A_PtrSize)
										Dim ChildArray.VARIANT(cChildren)
										Dim Children.i(cChildren)
										
										If CallFunction(0, "AccessibleChildren", *objectIa, 0, cChildren, *varChildren, @iObtained) = #S_OK 
										  AddGadgetItem(1,-1,"children ok ")
										  For i = 0 To iObtained - 1
										  	AddGadgetItem(1,-1, "i = "+ Str(i))
												;*objectIa\get_accChild(ChildArray(i), @*ChildDispatch)
										  	index = i * 16 + 8;32bit app => 16= A_PtrSize*2+8
										  	AddGadgetItem(1,-1, "     index = "+ Str(index))
										  	child = PeekI(*varChildren + index)
										  	AddGadgetItem(1,-1, "     child = "+ Hex(child))
												;Debug PeekI(*varChildren + index-8)
										  	If PeekI(*varChildren + index-8) = 9
										  		AddGadgetItem(1,-1, "     peek = 9")
												  chk = *objectIa\QueryInterface(?IID_Accessible, @child);= #S_OK
												  AddGadgetItem(1,-1,"chk = " + Str(chk))
												  AddGadgetItem(1,-1, "     new child = " + Hex(child))
													Children(i) = child
													;Debug child
													;Debug Hex(*objectIa\QueryInterface(?IID_Accessible,@child) )
													;Debug child
												Else
													AddGadgetItem(1,-1, "     peek = " + Str(PeekI(*varChildren + index-8)))
													Children(i) = child
													;return Childern
												EndIf
												AddGadgetItem(1,-1, "")
											Next

											v\vt = #VT_I4
											v\lVal = #CHILDID_SELF
											For i = 0 To iObtained - 1
												AddGadgetItem(1,-1, "Children("+ Str(i) + ")" + Hex(Children(i)))
												*objectIa = Children(i)
												;CopyMemory(@Children(i),*objectIa, SizeOf(child))
												If *objectIa\get_accRole(v, @v) = #S_OK
													Select v\lVal 
														Case #ROLE_SYSTEM_PANE, #ROLE_SYSTEM_DOCUMENT, #ROLE_SYSTEM_TEXT, #ROLE_SYSTEM_CLIENT, #ROLE_SYSTEM_PAGETAB, #ROLE_SYSTEM_WINDOW
															bstr = ASCIItoBSTR(Space(#MAX_PATH))
															v\vt = #VT_I4
															v\lVal = #CHILDID_SELF
															AddGadgetItem(1,-1,Hex(*objectIa\get_accValue(v, @bstr)))
													EndSelect
												EndIf
												
											Next
										Else
											Debug "Error"
										EndIf
									EndIf
								Else
										Debug("  URL TO CHECK  ERROR  -  get_accValue = " + Hex(iik))
								EndIf
							Default
								;Debug("  URL TO CHECK  ERROR  -  v\lVal = " + Hex(v\lVal))
					EndSelect
					*objectIa\Release()
				Else
					AddGadgetItem(1,-1,"  URL TO CHECK  ERROR  -  get_accRole = " + Hex(*objectIa\get_accRole(v, @v)))
				EndIf
			Else
				AddGadgetItem(1,-1,"  URL TO CHECK  ERROR  -  AccessibleObjectFromEvent")
			EndIf
			;EndIf
		;Default
		;	Debug_Me("  URL TO CHECK  ERROR  - EVENT = " + Hex(hEvent))
EndSelect
EndProcedure

If OpenWindow(0, 0, 0, 500, 400, "Read Browser URL", #PB_Window_SystemMenu)
  CoInitialize_(0);
  hdll = OpenLibrary(0, "Oleacc.dll")
  EditorGadget(1, 10, 15, 480, 380)
  ;...Set event hook
  eHook = SetWinEventHook_(#EVENT_OBJECT_FOCUS, #EVENT_OBJECT_VALUECHANGE, #Null, @WinEventFunc(), 0, 0, #WINEVENT_OUTOFCONTEXT | #WINEVENT_SKIPOWNPROCESS)
  Repeat
    event = WaitWindowEvent()
  Until event = #PB_Event_CloseWindow
  ;...Cleanup
  CoUninitialize_()
  If eHook
    UnhookWinEvent_(eHook)
  EndIf
  If hdll
    CloseLibrary(0)
  EndIf
EndIf
End

DataSection
IID_Accessible:; 618736e0-3c3d-11cf-810c-00aa00389b71
  Data.l $618736e0
  Data.w $3c3d,$11cf
  Data.b $81,$0c,$00,$aa,$00,$38,$9b,$71
EndDataSection

Re: Read DirectUIHWND class window and select item.[solved]

Posted: Sat Jul 16, 2016 7:06 pm
by SeregaZ
did you test our code? i think it will be read this. what browser you want to use?

Re: Read DirectUIHWND class window and select item.[solved]

Posted: Sat Jul 16, 2016 7:57 pm
by doctorized
SeregaZ wrote:did you test our code? i think it will be read this. what browser you want to use?
I want to use Chrome. Yes, I tested the code for both chrome_widgetwin_0 and chrome_widgetwin_1 classes of Chrome but no url appeared.

Re: Read DirectUIHWND class window and select item.[solved]

Posted: Fri Jul 22, 2016 7:49 am
by SeregaZ
XP, PB5.31, Chrome 43 or 44 old version:

Image

try test admin rights. and did you correct set window class name for search? i set as hwnd = FindWindow_( "Chrome_WidgetWin_1", 0)

and probably chrome have his own protect. becouse i cant to get from chrome's window values, where shows certificate selector when you want to autorize some special cites. probably they made same with newer version. some kind another type of DirectUIHWN... or just i am dumbass and cant understand how to use it :)

Re: Read DirectUIHWND class window and select item.[solved]

Posted: Fri Jul 22, 2016 9:22 pm
by tj1010
If I remember correctly IE, FF, Chrome, and Opera all have dynamic libraries(dll) that you can hook to modify DOM and get UI data like the URL bar contents. I know because they are what malware use for "web injects" and mining marketing data. Chrome has the easiest one there is a single DLL with all the exports needed.

Re: Read DirectUIHWND class window and select item.[solved]

Posted: Sat Jul 23, 2016 11:28 am
by doctorized
SeregaZ wrote:XP, PB5.31, Chrome 43 or 44 old version:

try test admin rights. and did you correct set window class name for search? i set as hwnd = FindWindow_( "Chrome_WidgetWin_1", 0)

and probably chrome have his own protect. becouse i cant to get from chrome's window values, where shows certificate selector when you want to autorize some special cites. probably they made same with newer version. some kind another type of DirectUIHWN... or just i am dumbass and cant understand how to use it :)
I said above that I used both Chrome_WidgetWin_0 and Chrome_WidgetWin_1 with no success. I used admin rights but nothing changed.
Which code did you use? I used this one:

Code: Select all

EnableExplicit

CompilerIf (#PB_Compiler_Unicode = 0)
 CompilerError "Turn on: Create Unicode executable"
CompilerEndIf

Macro DEFINE_GUID(Name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8)
  CompilerIf Defined(Name, #PB_Variable)
  If SizeOf(Name) = SizeOf(GUID)
    Name\Data1    = l
    Name\Data2    = w1
    Name\Data3    = w2
    Name\Data4[0] = b1
    Name\Data4[1] = b2
    Name\Data4[2] = b3
    Name\Data4[3] = b4
    Name\Data4[4] = b5
    Name\Data4[5] = b6
    Name\Data4[6] = b7
    Name\Data4[7] = b8
  EndIf
  CompilerEndIf
EndMacro

Global IID_IAccessible.GUID
DEFINE_GUID(IID_IAccessible, $618736e0, $3c3d, $11cf, $81, $0c, $00, $aa, $00, $38, $9b, $71)

Global IID_IEnumVARIANT.GUID ; 00020404-0000-0000-C000-000000000046
DEFINE_GUID(IID_IEnumVARIANT, $00020404, $0000, $0000, $c0, $00, $00, $00, $00, $00, $00, $46)
;http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.comtypes.ienumvariant.aspx


Prototype.l ProtoAccessibleObjectFromWindow(hwnd.i,dwObjectID.l, riid, *ppvObject)
Global AccessibleObjectFromWindow.ProtoAccessibleObjectFromWindow

Prototype.l ProtoAccessibleChildren(*paccContainer,iChildStart.l,cChildren.l,*rgvarChildren,*pcObtained)
Global AccessibleChildren.ProtoAccessibleChildren


Define hdll, hwnd
Define *Accessible.IAccessible

CoInitialize_(0)

hdll=OpenLibrary(#PB_Any,"Oleacc.dll")

AccessibleObjectFromWindow = GetFunction(hdll,"AccessibleObjectFromWindow")
AccessibleChildren = GetFunction(hdll,"AccessibleChildren")

#NAVDIR_DOWN = 2
#NAVDIR_FIRSTCHILD = 7
#NAVDIR_LASTCHILD = 8
#NAVDIR_LEFT = 3
#NAVDIR_NEXT = 5
#NAVDIR_PREVIOUS = 6
#NAVDIR_RIGHT = 4
#NAVDIR_UP = 1

#CHILDID_SELF = 0

;http://msdn.microsoft.com/en-us/library/windows/desktop/dd318474(v=vs.85).aspx
#SELFLAG_TAKEFOCUS = 1
#SELFLAG_TAKESELECTION = 2
     
Declare    ProcessChild (*aAccessible.IAccessible, aOffset$, *aChild.VARIANT)
Declare    DisplayInfo (*aAccessible.IAccessible, aOffset$ )

Procedure.s GetBSTR (*BSTR_wsText) ; needed to trap NULL BSTR (seem it's possible and valid)
  If *BSTR_wsText
    ProcedureReturn PeekS(*BSTR_wsText)
  EndIf
  ProcedureReturn ""
EndProcedure

Procedure ProcessChild (*aAccessible.IAccessible, aOffset$, *aChild.VARIANT)
 Protected *ChildAccessible.IAccessible
 Protected *ChildDispatch.IDispatch
 
 Select *aChild\vt
    Case #VT_I4 ; varInteger (was #VT_INT, wrong, see http://delphi.about.com/library/weekly/aa122104a.htm)
        *aAccessible\get_accChild(*aChild, @*ChildDispatch)
    Case #VT_DISPATCH ; varDispatch
        *ChildDispatch = *aChild\pdispVal
 EndSelect
 
 If *ChildDispatch <> #Null And *ChildDispatch\QueryInterface(@IID_IAccessible, @*ChildAccessible) = #S_OK
     DisplayInfo(*ChildAccessible, aOffset$ + " ")
 EndIf
EndProcedure

Procedure DisplayInfo (*aAccessible.IAccessible, aOffset$ )
 Protected count, iObtained
 Protected BSTR_wsText
 Protected vt.VARIANT, i, err
 Protected *enum.IEnumVARIANT
 
 vt\vt = #VT_I4
 vt\lVal = #CHILDID_SELF
 
 If *aAccessible
    ;;; allocation not needed, see post below by Josh
    ;;; BSTR_wsText = SysAllocString_("")
   
    If *aAccessible\get_accName(vt, @BSTR_wsText) = #S_OK
        Debug aOffset$ + "Name: " + GetBSTR(BSTR_wsText)
       
        If GetBSTR(BSTR_wsText) = "File"
          err = *aAccessible\accSelect(#SELFLAG_TAKEFOCUS | #SELFLAG_TAKESELECTION, vt)       
          Debug err
        EndIf           
       
        SysFreeString_(BSTR_wsText)
    Else
        Debug aOffset$ + "Name: Empty"
    EndIf

    If *aAccessible\get_AccValue(vt, @BSTR_wsText) = #S_OK
        Debug aOffset$ + " Value: " + GetBSTR(BSTR_wsText)
        SysFreeString_(BSTR_wsText)
    EndIf
   
    If *aAccessible\get_AccDescription(vt, @BSTR_wsText) = #S_OK
        Debug aOffset$ + " Description: " + GetBSTR(BSTR_wsText)
        SysFreeString_(BSTR_wsText)
    EndIf
   
    If *aAccessible\get_accChildCount(@count) = #S_OK And count > 0     
        aOffset$ + " " ; fix indenting
        Debug aOffset$ + "Children: " + Str(count)
           
        Dim ChildArray.VARIANT(count)
        Protected Child.VARIANT, CurrentChild.VARIANT
        Protected dwNum.l
       
        If AccessibleChildren(*aAccessible, 0, count, @ChildArray(0), @iObtained) = #S_OK   
            For i = 0 To iObtained - 1
                ProcessChild(*aAccessible, aOffset$, ChildArray(i))         
            Next
        ElseIf *aAccessible\QueryInterface(@IID_IEnumVARIANT, @*enum) = #S_OK
            ;
            ;*enum = *aAccessible ; this look definitely wrong, don't know how this did work in delphi
            ;         
            *enum\Reset() ; for good measure
           
            For i = 0 To count - 1               
                If *enum\Next(1, @Child, 0) = #S_OK
                    ProcessChild(*aAccessible, aOffset$, @Child)
                EndIf
            Next
        Else
            If *aAccessible\accNavigate(#NAVDIR_FIRSTCHILD, vt, @CurrentChild) = #S_OK
                Repeat
                    ProcessChild(*aAccessible, aOffset$, @CurrentChild)
                Until *aAccessible\accNavigate(#NAVDIR_NEXT, @CurrentChild, @CurrentChild) <> #S_OK
            EndIf               
       EndIf
    EndIf
   
   
   
    VariantClear_(vt)
   
 EndIf
EndProcedure


hwnd = FindWindow_( "Chrome_WidgetWin_1", 0)

If hwnd       
    SetForegroundWindow_(hwnd)
    If AccessibleObjectFromWindow(hwnd, 0, @IID_IAccessible, @*Accessible) = #S_OK     
        DisplayInfo(*Accessible, "")
    EndIf
EndIf
and i get these:

Code: Select all

Name: Empty
 Children: 7
  Name: Σύστημα
   Description: Περιέχει εντολές για τη διαχείριση του παραθύρου
  Name: Empty
   Description: Εμφανίζει το όνομα παραθύρου και περιέχει τις ρυθμίσεις για την διαχείρισή του
   Children: 5
  Name: Εφαρμογή
   Description: Περιέχει εντολές για τη διαχείριση της τρέχουσας προβολής ή κειμένου
  Name: Empty
   Children: 1
    Name: Empty
  Name: Κατακόρυφα
   Value: 0
   Description: Χρησιμοποιείται για την αλλαγή της περιοχής κατακόρυφης προβολής
   Children: 5
  Name: Οριζόντια
   Value: 0
   Description: Χρησιμοποιείται για την αλλαγή της περιοχής οριζόντιας προβολής
   Children: 5
  Name: Empty
It is in greek but as you can see there is no url. What am I doing wrong? My Chrome version is 51, the latest one.

tj1010 wrote:If I remember correctly IE, FF, Chrome, and Opera all have dynamic libraries(dll) that you can hook to modify DOM and get UI data like the URL bar contents. I know because they are what malware use for "web injects" and mining marketing data. Chrome has the easiest one there is a single DLL with all the exports needed.
Which is that lib? Do we have any more info?

Re: Read DirectUIHWND class window and select item.[solved]

Posted: Sat Jul 23, 2016 1:37 pm
by SeregaZ
i start your code - all shows fine. you sure this url is not in a list of debug? it is a big list. maybe you just missed it?

i make comment all of string, exept value and even i get title of page :)

Code: Select all

EnableExplicit

CompilerIf (#PB_Compiler_Unicode = 0)
 CompilerError "Turn on: Create Unicode executable"
CompilerEndIf

Macro DEFINE_GUID(Name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8)
  CompilerIf Defined(Name, #PB_Variable)
  If SizeOf(Name) = SizeOf(GUID)
    Name\Data1    = l
    Name\Data2    = w1
    Name\Data3    = w2
    Name\Data4[0] = b1
    Name\Data4[1] = b2
    Name\Data4[2] = b3
    Name\Data4[3] = b4
    Name\Data4[4] = b5
    Name\Data4[5] = b6
    Name\Data4[6] = b7
    Name\Data4[7] = b8
  EndIf
  CompilerEndIf
EndMacro

Global IID_IAccessible.GUID
DEFINE_GUID(IID_IAccessible, $618736e0, $3c3d, $11cf, $81, $0c, $00, $aa, $00, $38, $9b, $71)

Global IID_IEnumVARIANT.GUID ; 00020404-0000-0000-C000-000000000046
DEFINE_GUID(IID_IEnumVARIANT, $00020404, $0000, $0000, $c0, $00, $00, $00, $00, $00, $00, $46)
;http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.comtypes.ienumvariant.aspx


Prototype.l ProtoAccessibleObjectFromWindow(hwnd.i,dwObjectID.l, riid, *ppvObject)
Global AccessibleObjectFromWindow.ProtoAccessibleObjectFromWindow

Prototype.l ProtoAccessibleChildren(*paccContainer,iChildStart.l,cChildren.l,*rgvarChildren,*pcObtained)
Global AccessibleChildren.ProtoAccessibleChildren


Define hdll, hwnd
Define *Accessible.IAccessible

CoInitialize_(0)

hdll=OpenLibrary(#PB_Any,"Oleacc.dll")

AccessibleObjectFromWindow = GetFunction(hdll,"AccessibleObjectFromWindow")
AccessibleChildren = GetFunction(hdll,"AccessibleChildren")

#NAVDIR_DOWN = 2
#NAVDIR_FIRSTCHILD = 7
#NAVDIR_LASTCHILD = 8
#NAVDIR_LEFT = 3
#NAVDIR_NEXT = 5
#NAVDIR_PREVIOUS = 6
#NAVDIR_RIGHT = 4
#NAVDIR_UP = 1

#CHILDID_SELF = 0

;http://msdn.microsoft.com/en-us/library/windows/desktop/dd318474(v=vs.85).aspx
#SELFLAG_TAKEFOCUS = 1
#SELFLAG_TAKESELECTION = 2
     
Declare    ProcessChild (*aAccessible.IAccessible, aOffset$, *aChild.VARIANT)
Declare    DisplayInfo (*aAccessible.IAccessible, aOffset$ )

Procedure.s GetBSTR (*BSTR_wsText) ; needed to trap NULL BSTR (seem it's possible and valid)
  If *BSTR_wsText
    ProcedureReturn PeekS(*BSTR_wsText)
  EndIf
  ProcedureReturn ""
EndProcedure

Procedure ProcessChild (*aAccessible.IAccessible, aOffset$, *aChild.VARIANT)
 Protected *ChildAccessible.IAccessible
 Protected *ChildDispatch.IDispatch
 
 Select *aChild\vt
    Case #VT_I4 ; varInteger (was #VT_INT, wrong, see http://delphi.about.com/library/weekly/aa122104a.htm)
        *aAccessible\get_accChild(*aChild, @*ChildDispatch)
    Case #VT_DISPATCH ; varDispatch
        *ChildDispatch = *aChild\pdispVal
 EndSelect
 
 If *ChildDispatch <> #Null And *ChildDispatch\QueryInterface(@IID_IAccessible, @*ChildAccessible) = #S_OK
     DisplayInfo(*ChildAccessible, aOffset$ + " ")
 EndIf
EndProcedure

Procedure DisplayInfo (*aAccessible.IAccessible, aOffset$ )
 Protected count, iObtained
 Protected BSTR_wsText
 Protected vt.VARIANT, i, err
 Protected *enum.IEnumVARIANT
 Protected tmp$
 
 vt\vt = #VT_I4
 vt\lVal = #CHILDID_SELF
 
 If *aAccessible
    ;;; allocation not needed, see post below by Josh
    ;;; BSTR_wsText = SysAllocString_("")
   
    If *aAccessible\get_accName(vt, @BSTR_wsText) = #S_OK
        ;Debug aOffset$ + "Name: " + GetBSTR(BSTR_wsText)
       
        If GetBSTR(BSTR_wsText) = "File"
          err = *aAccessible\accSelect(#SELFLAG_TAKEFOCUS | #SELFLAG_TAKESELECTION, vt)       
          Debug err
        EndIf           
       
        SysFreeString_(BSTR_wsText)
    Else
        ;Debug aOffset$ + "Name: Empty"
    EndIf

    If *aAccessible\get_AccValue(vt, @BSTR_wsText) = #S_OK
        Debug aOffset$ + " Value: " + GetBSTR(BSTR_wsText)
        SysFreeString_(BSTR_wsText)
    EndIf
   
    If *aAccessible\get_AccDescription(vt, @BSTR_wsText) = #S_OK
        ;Debug aOffset$ + " Description: " + GetBSTR(BSTR_wsText)
        SysFreeString_(BSTR_wsText)
    EndIf
   
    If *aAccessible\get_accChildCount(@count) = #S_OK And count > 0     
        aOffset$ + " " ; fix indenting
        ;Debug aOffset$ + "Children: " + Str(count)
           
        Dim ChildArray.VARIANT(count)
        Protected Child.VARIANT, CurrentChild.VARIANT
        Protected dwNum.l
       
        If AccessibleChildren(*aAccessible, 0, count, @ChildArray(0), @iObtained) = #S_OK   
            For i = 0 To iObtained - 1
                ProcessChild(*aAccessible, aOffset$, ChildArray(i))         
            Next
        ElseIf *aAccessible\QueryInterface(@IID_IEnumVARIANT, @*enum) = #S_OK
            ;
            ;*enum = *aAccessible ; this look definitely wrong, don't know how this did work in delphi
            ;         
            *enum\Reset() ; for good measure
           
            For i = 0 To count - 1               
                If *enum\Next(1, @Child, 0) = #S_OK
                    ProcessChild(*aAccessible, aOffset$, @Child)
                EndIf
            Next
        Else
            If *aAccessible\accNavigate(#NAVDIR_FIRSTCHILD, vt, @CurrentChild) = #S_OK
                Repeat
                    ProcessChild(*aAccessible, aOffset$, @CurrentChild)
                Until *aAccessible\accNavigate(#NAVDIR_NEXT, @CurrentChild, @CurrentChild) <> #S_OK
            EndIf               
       EndIf
    EndIf
   
   
   
    VariantClear_(vt)
   
 EndIf
EndProcedure


hwnd = FindWindow_( "Chrome_WidgetWin_1", 0)

If hwnd       
    SetForegroundWindow_(hwnd)
    If AccessibleObjectFromWindow(hwnd, 0, @IID_IAccessible, @*Accessible) = #S_OK     
        DisplayInfo(*Accessible, "")
    EndIf
EndIf

Re: Read DirectUIHWND class window and select item.[solved]

Posted: Sat Jul 23, 2016 1:52 pm
by doctorized
SeregaZ wrote:i start your code - all shows fine. you sure this url is not in a list of debug? it is a big list. maybe you just missed it?

i make comment all of string, exept value and even i get title of page :)
In older versions of Chrome I could take url with no problem. The last 10 months I cannot. I have the problem with every url, even with http://www.google.com. Something changed with the new versions. You can take the url as you have very old version. Use version 51 to see what I see.


EDIT: It is possible to take url from version 51 of Chrome without admin rights. I found this script https://autohotkey.com/boards/viewtopic ... rowser+tab that does the job but I fail to translate it correctly to PB.

Re: Read DirectUIHWND class window and select item.[solved]

Posted: Sun Jul 24, 2016 11:13 am
by tj1010
doctorized wrote:Which is that lib? Do we have any more info?
It's probably just chrome.dll now for Chrome. It's mapped in to each PID for each tab. Easiest way to find out is hook all it's exports and log or use a memory scanner and look for keywords then find what assembly funtion is writing to that buffer using breakpoints etc..

Once found you could send it over a named pipe or something else. It's probably easiest for IE because it's just made up of COM framework under a single PID with all libraries static or loaded inside.

This is how security products and malware do it. You just have to find out what to hook.

Re: Read DirectUIHWND class window and select item.[solved]

Posted: Sat Aug 06, 2016 10:43 pm
by doctorized
The solution to my problem is to go deeper in the children. When the code tells , for example, 7 children how can I see these children?