Re: CHtmlView document.returnValue
On 21 May 2007 08:46:34 -0700, Francesco Vitale
<francesco.vitale@gmail.com> wrote:
Here follows my HTML code:
<HTML>
<BODY oncontextmenu="return false">
<script>
window.returnValue = "I_have_to_get_this_value"
function closeMyPage(){
self.close();
}
</script>
<center>
Click on this button to close the window <INPUT TYPE="button"
VALUE="Close" onClick="closeMyPage()">
</center>
</BODY>
</HTML>
and yes... I'm trying to get the "I_have_to_get_this_value".
I think that the easiest thing to do is to add a function in your
JavaScript HTML file, like this:
function getTheWindowReturnValue() {
return window.returnValue;
}
And then you can invoke this function from C++, with the code I showed
in my previous post. This function will just return the
'window.returnValue' that you want.
I did the test and it works fine.
A more elegant approach would be to navigate the DOM object model
using COM to reach the window.returnValue property.
However, it would require more lines of C++ code (all COM stuff,
QueryInterface, Invoke, etc.) and much more complex code than just
adding a simple JavaScript function and calling it with the code I
listed in my previous post.
MrAsm