Page 1 of 1

Get the current URL from IE (or any other browser)

Posted: Sun Jun 20, 2004 5:07 am
by Mortamer
Hello, I'd like to know a way to get the current URL for IE or any other browser? I'd like to get all of the URLs if their are multiple instances. Is this possible using PB?

Posted: Sun Jun 20, 2004 8:12 am
by PolyVector
I think you can use GetGadgetText(GadgetNumber)....
But you can always try this way too :D

Code: Select all

Procedure.s ByteStr(pointer.l) 
  strlen.w = WideCharToMultiByte_(#CP_ACP, 0, pointer, -1, 0, 0 , 0, 0) 
  string.s = Space(strlen) 
  If strlen <> 0 
    newlen.w = WideCharToMultiByte_(#CP_ACP, 0, pointer, -1, @string, strlen , 0, 0) 
  EndIf 
  SysFreeString_(pointer)  ; <<---- free the string. 
  ProcedureReturn string 
EndProcedure 
  
Procedure.s GetLocationName$(WebGadgetNumber.l) 
  Protected WebObject.IWebBrowser2,Ptr.l 
  WebObject = GetWindowLong_(GadgetID(WebGadgetNumber), #GWL_USERDATA) 
  WebObject\get_LocationName(@Ptr.l) 
  ProcedureReturn ByteStr(Ptr) 
EndProcedure

Procedure.s GetLocationURL$(WebGadgetNumber.l) 
  Protected WebObject.IWebBrowser2,Ptr.l 
  WebObject = GetWindowLong_(GadgetID(WebGadgetNumber), #GWL_USERDATA) 
  WebObject\get_LocationURL(@Ptr.l) 
  ProcedureReturn ByteStr(Ptr) 
EndProcedure

Posted: Tue Jun 22, 2004 12:48 am
by Mortamer
I don't really understand that code, but are you sure it'd work for internet explorer? Wouldn't that just get the url from a web gadget?

Re: Get the current URL from IE (or any other browser)

Posted: Tue Jun 22, 2004 12:59 am
by PB
> I'd like to know a way to get the current URL for IE

Justin's answer here works for me with IE:

viewtopic.php?t=4478

(BTW, please use the Search function here... I found the link above
simply by searching for "Internet Explorer"). ;)

Posted: Fri Jun 25, 2004 8:40 pm
by Mortamer
ok thanks, I'll get used to searching :P .