I have an input tag
<input class= " " size = " " read-only=" " value=" ">
(I get this when I do a get_innerHtml()
on an IHTMLELEMENT
object).
The library used is ATL.
I need to extract the text present in the value. Is there a way in which i can retrieve the text using an api?
Investigation Details:
I have tried using the getAttribute()
api with the property as "value". This returns me a value "I4=0" in the variant. The element under question is a "list-item". With Tag as "LI". Get_innerText
api gives me a garbage value.
Note: Outer Html value is:
<li class=" "id= " "><input class= " " size= " " read-only=" " value=" "></li>
Here is the code:
CComBSTR bsValue = NULL;
pHtmlElement->get_innerText(&bsValue);
char* innerText = convertBSTRToCharPtr(bsValue);
CString cstring(innerText);
You can use the getAttribute() api on the IHtmlElement using the property as "value".
CComBSTR bsProperty;
bsProperty = "value";
pChild->getAttribute(bsProperty,0,&vtVariant);
bsValue1 = vtVariant.bstrVal;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.