Hi there,
Could someone please tell me how to go about getting the title of a web page which is being displayed in a WebGadget?
Obtaining the title of a web page
- Dreamland Fantasy
- Enthusiast

- Posts: 335
- Joined: Fri Jun 11, 2004 9:35 pm
- Location: Glasgow, UK
- Contact:
-
PolyVector
- Enthusiast

- Posts: 499
- Joined: Wed Sep 17, 2003 9:17 pm
- Location: Southern California
- Contact:
No time to test... but it should go something like this...
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
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)
EndProcedureYour procedure works. However, since you are dealing with a BSTR string
here, you should call SysFreeString_() to free it when it is no longer needed.
So the ByteStr() procedure could look like this:
Timo
here, you should call SysFreeString_() to free it when it is no longer needed.
So the ByteStr() procedure could look like this:
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 quidquid Latine dictum sit altum videtur
-
PolyVector
- Enthusiast

- Posts: 499
- Joined: Wed Sep 17, 2003 9:17 pm
- Location: Southern California
- Contact:
- Dreamland Fantasy
- Enthusiast

- Posts: 335
- Joined: Fri Jun 11, 2004 9:35 pm
- Location: Glasgow, UK
- Contact:
