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

Everything else that doesn't fall into one of the other PB categories.
Mortamer
User
User
Posts: 36
Joined: Mon Dec 29, 2003 5:07 pm

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

Post 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?
PolyVector
Enthusiast
Enthusiast
Posts: 499
Joined: Wed Sep 17, 2003 9:17 pm
Location: Southern California
Contact:

Post 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
Mortamer
User
User
Posts: 36
Joined: Mon Dec 29, 2003 5:07 pm

Post 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?
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

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

Post 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"). ;)
Mortamer
User
User
Posts: 36
Joined: Mon Dec 29, 2003 5:07 pm

Post by Mortamer »

ok thanks, I'll get used to searching :P .
Post Reply