Hello, sorry to bump up this topic, but, I'm having a tought time trying to solve my problem as I sadly understand almost nothing in these procedures.
I'd like to know why is the procedure sending multiple time the same url$? For eatch page I get between 1 and 3 time the same url$
but most of the time I get it twice.
And I've just seen that when clicking the 'Post a reply' page, I even got :"Tip: Styles can be applied quickly to selected text." as a result for the 'address'.
Also made a little modification as with Firefox 11.0 the url address bar give the correct address and then choped the "http://" part sending 2 different url$ for eatch page you visit.
I've also tried with IE just to see the result, same, returns between 1 and 3 time eatch page but doesn't have the "http://" issue.
Code: Select all
#CHILDID_SELF = 0
#WINEVENT_OUTOFCONTEXT = 0
#WINEVENT_SKIPOWNPROCESS = $2
#EVENT_OBJECT_FOCUS = $8005
#EVENT_OBJECT_VALUECHANGE = $800E
#ROLE_SYSTEM_DOCUMENT = $F
#ROLE_SYSTEM_PANE = $10
#ROLE_SYSTEM_TEXT = $2A
Procedure.l ASCIItoBSTR(asciiString$)
; Thanks to freak for this one
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, a.i=0, b.i=0, c.i=0, d.i=0, e.i=0, f.i=0, g.i=0, h.i=0, i.i=0, j.i=0
Static previousUrl$
Select hEvent
Case #EVENT_OBJECT_FOCUS, #EVENT_OBJECT_VALUECHANGE
className$ = Space(256)
GetClassName_(hwnd, @className$, 256)
If className$ = "MozillaWindowClass" Or className$ = "Internet Explorer_Server"
If CallFunction(0, "AccessibleObjectFromEvent", hwnd, idObject, idChild, @*objectIa, @v.VARIANT) = #S_OK
v.VARIANT\vt = #VT_I4
v\lVal = #CHILDID_SELF
If *objectIa\get_accRole(v, @v) = #S_OK
If v\lVal = #ROLE_SYSTEM_PANE Or v\lVal = #ROLE_SYSTEM_DOCUMENT Or v\lVal = #ROLE_SYSTEM_TEXT
v\vt = #VT_I4
v\lVal = #CHILDID_SELF
url$ = Space(#MAX_PATH)
bstr = ASCIItoBSTR(Space(#MAX_PATH))
If *objectIa\get_accValue(v, @bstr) = #S_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)
If previousUrl$ <> url$ And url$ <> ""
If Left(url$, 7) = "http://"
;
ElseIf Left(url$, 4) = "www."
url$="http://"+url$
EndIf
AddGadgetItem(2, -1, url$) : SetClipboardText(url$)
EndIf
EndIf
EndIf
*objectIa\Release()
EndIf
EndIf
EndIf
EndSelect
EndProcedure
OpenWindow(0, 550, 450, 500, 500, "Try", #PB_Window_MinimizeGadget)
ButtonGadget(1, 10, 10, 120, 40, "Snif", #PB_Button_Toggle)
ListViewGadget(2, 10, 60, 480, 430)
quit = 0
CoInitialize_(0)
hdll = OpenLibrary(0, "Oleacc.dll")
Repeat
Event = WaitWindowEvent()
Select EventWindow()
Case 0
Select Event
Case #PB_Event_Gadget
Select EventGadget()
Case 1
If GetGadgetState(1) = 1
eHook = SetWinEventHook_(#EVENT_OBJECT_FOCUS, #EVENT_OBJECT_VALUECHANGE, #Null, @WinEventFunc(), 0, 0, #WINEVENT_OUTOFCONTEXT|#WINEVENT_SKIPOWNPROCESS)
Else
UnhookWinEvent_(eHook)
EndIf
EndSelect
Case #PB_Event_CloseWindow : Quit = 1
EndSelect
EndSelect
Until quit = 1
CoUninitialize_()
If eHook : UnhookWinEvent_(eHook) : EndIf
If hdll : CloseLibrary(0) : EndIf
If someone could help my, would be very apreciated
