Google Answers Logo
View Question
 
Q: How use getAttribute function? ( No Answer,   2 Comments )
Question  
Subject: How use getAttribute function?
Category: Computers
Asked by: hareum-ga
List Price: $5.00
Posted: 06 May 2004 19:18 PDT
Expires: 07 May 2004 19:08 PDT
Question ID: 342438
I use the getAttribute function of IHTMLElement class.
I want MFC application get the attribute of the HTML file.
But the getAttribute function always get null value.
I must use another functin to get the value if the HTML file???
I show you the MFC code and HTML source.
Please help me.

// This is MFC code
void
CCyberChatDlg::OnChat()
{
	IHTMLDocument2* pCtrl=(IHTMLDocument2*)m_oMainDlg.m_pWebCtrl->GetHtmlDocument();
	IHTMLWindow2 *pWindow=(IHTMLWindow2*)NULL;
	pCtrl->get_parentWindow(&pWindow);
	IHTMLElement* pElement=(IHTMLElement*)NULL;
	pCtrl->get_body(&pElement);

	HRESULT hResult;
	VARIANT oAttr;
	hResult=pElement->getAttribute(L"strMSG.value", 1, &oAttr);
                                                  // oAttr always return 0 !!!
}

// HTML Source
<html>

<head>
</head>

<body bgcolor="#ffffff" leftmargin="0" topmargin="0" marginwidth="0"
marginheight="0" >
<INPUT name="strMSG" ID="strMSG" size="53" style="FONT-SIZE: 9pt;
COLOR: #333333; FONT-FAMILY: ??">

</body>
</html>
Answer  
There is no answer at this time.

Comments  
Subject: Re: How use getAttribute function?
From: realegor-ga on 07 May 2004 01:53 PDT
 
Maybe try  getAttribute(L"strMSG.value",0, &oAttr);?
I'm not sure but it could help.
Did you see MSDN help on this function?
Subject: Re: How use getAttribute function?
From: hareum-ga on 07 May 2004 05:29 PDT
 
I try  getAttribute(L"strMSG.value",0, &oAttr); code...
But the result oAttr value is still null.

My visual C++ version is 6.0 and I don't install Visual C++ service pack.
Is this function acts differnt according to visual C++ version?
Or I must use another function?

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy