![]() |
|
![]() | ||
|
Subject:
[Question] execScript function
Category: Computers Asked by: hareum-ga List Price: $5.00 |
Posted:
06 May 2004 09:39 PDT
Expires: 06 May 2004 17:40 PDT Question ID: 342114 |
Hello!!! I'm a computer progaram engineer from korea. I develop the application with MFC. I have a trouble with using IHTMLWindow2 class... The execscript function do a javascript function sucessfully. The javascript funtion of HTML or ASP file. But the third parametar which represents the return value of script function did not represents the value. The VARIANT value always VT_EMPTY. I have no idea why it's value is always VT_EMPTY. I show you my MFC and javascript code. // MFC Function void CTestDlg::OnButton1() { // TODO: Add your control notification handler code here IHTMLDocument2* pCtrl=(IHTMLDocument2*)m_oMainDlg.m_pWebCtrl->GetHtmlDocument(); IHTMLWindow2 *pWindow=(IHTMLWindow2*)NULL; pCtrl->get_parentWindow(&pWindow); BSTR strSript; BSTR strLanguage; strSript=L"Javascript:OnChat(\"[Julia]\", \"Hello!!!\");"; strLanguage=L"JavaScript"; VARIANT nResult; HRESULT hResult; hResult=pWindow->execScript(strSript, strLanguage, &nResult); // the value of nResult is always VT_EMPTY... } // HTML source <html> <head> <script language="JavaScript"> function OnChat(strUser, strMessage) { var RetVal=new InitArray(2); RetVal[0]=DecoMessage(strUser); RetVal[1]=DecoMessage(strMessage); AddMessage(RetVal); var strmsg; strmsg="Test"; return strmsg; } </script> </head> <body> </body> <html> |
![]() | ||
|
There is no answer at this time. |
![]() | ||
|
Subject:
Re: [Question] execScript function
From: stolis-ga on 06 May 2004 10:03 PDT |
"This method always returns VT_EMPTY." According to Microsoft's documentation: http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/mshtml/reference/ifaces/window2/execscript.asp I believe you should be testing for S_OK in hResult, not nResult. |
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 Home - Answers FAQ - Terms of Service - Privacy Policy |