some webpages content may changed after loading(js control).
so I want to get the final text through the webgadget
but the webgadget getgadgetitemtext method has no #pb_web_alltext parameter.
What should I do?
how to get all text from the webgadget
Re: how to get all text from the webgadget
Problem solved, here are some key codes.
You can determine whether the web has been loaded by detecting whether there are some keywords in the text.
I hope it is useful to those who need it.
Code: Select all
Protected *OuterHTML, Browser.IWebBrowser2 = GetWindowLongPtr_(GadgetID(WebGadget), #GWL_USERDATA)
Protected DocumentDispatch.IDispatch, DocElement.IHTMLElement, Document3.IHTMLDocument3
If Browser
If Browser\get_Document(@DocumentDispatch) = #S_OK And DocumentDispatch
If DocumentDispatch\QueryInterface(?IID_IHTMLDocument3, @Document3) = #S_OK And Document3
If Document3\get_documentElement(@DocElement) = #S_OK And DocElement
If DocElement\get_outerHTML(@*OuterHTML) = #S_OK;gethtml
....or......
If DocElement\get_innerText(@*innertext) = #S_OK;getalltext
I hope it is useful to those who need it.
Last edited by ynkrc on Tue Nov 19, 2024 3:34 pm, edited 1 time in total.
Re: how to get all text from the webgadget
Thanks, but it looks like this is not executable code.
Regarding the use of GetWindowLong_()
Please see the MSDN note on that.
Note If you are retrieving a pointer or a handle, this function has been superseded by the GetWindowLongPtr function. (Pointers and handles are 32 bits on 32-bit Windows and 64 bits on 64-bit Windows.) To write code that is compatible with both 32-bit and 64-bit versions of Windows, use GetWindowLongPtr.
Regarding the use of GetWindowLong_()
Please see the MSDN note on that.
Note If you are retrieving a pointer or a handle, this function has been superseded by the GetWindowLongPtr function. (Pointers and handles are 32 bits on 32-bit Windows and 64 bits on 64-bit Windows.) To write code that is compatible with both 32-bit and 64-bit versions of Windows, use GetWindowLongPtr.
Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
Re: how to get all text from the webgadget
Thank you for reminding me.
Axolotl wrote: Tue Nov 19, 2024 3:13 pm
Note If you are retrieving a pointer or a handle, this function has been superseded by the GetWindowLongPtr function. (Pointers and handles are 32 bits on 32-bit Windows and 64 bits on 64-bit Windows.) To write code that is compatible with both 32-bit and 64-bit versions of Windows, use GetWindowLongPtr.