Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

scripting through IHTMLDocument2 interface

0 views
Skip to first unread message

Chellury R. Sastry

unread,
Oct 21, 1999, 3:00:00 AM10/21/99
to
Friends,
have any of you tried to set scripts on a web page through an active
control by accessing the DHTML document object model through the
IHTMLDocument2 and other interfaces implemented in mshtml.dll? What I am
trying to do is simple. I have two frames, one contains an activeX
control written using say MFC or ATL, and in the other frame I have a
web page loaded in. Now in the activeX control, I get an IHTMLDocument2
interface pointer say pDoc to the document loaded in the other frame.
This is pretty standard and can be done. Now using pDoc, the INET SDK
documentations says that I could set any inline script. So, for example,
if I want to sent an onClick event handler, I do the following
pDoc->put_onClick(pScript)
where pScript is of type Variant containing the inline script that is to
be added. I am having no success doing this. We can into more details if
any good samaritan out there is interested in this issue and cares to
respond. Cheers
Chellury R. Sastry
Siemens Corporate Research
P.S. The reason I want to do cross-frame scripting through interface
pointers is because I cannot do cross frame scripting through
client-side javascript on Internet Explorer. The IE security model doesn
not permit cross frame scripting when the documents in the two frames
are coming from different domains.

Anil Kumar

unread,
Oct 22, 1999, 3:00:00 AM10/22/99
to
These event handlers require a pointer to an IDispatch.
See the recent posts regarding disabling drag drop for some
sample code that sets the ondragstart handler.

You may also want to check out the articles Q188015
and Q185127 from Microsoft.


Chellury R. Sastry <lak...@hotmail.com> wrote in message
news:380F6ADD...@hotmail.com...
: Friends,

:
:

Andrew Nosenko

unread,
Oct 22, 1999, 3:00:00 AM10/22/99
to
Hi Chellury,

Even if you script via C++ (through IHTMLDocument2), you still won't be able to
overcome cross domain restrictions. About your original question,

pDoc->put_onClick(handler)

<handler> should be a variant containg VT_DISPATCH. You should have an object
exposing IDispatch. By the time of event IDispatch::Invoke would be called with
DISPID_VALUE dispid.

--
Regards,
Andrew Nosenko,
Senior Software Engineer
Mead & Company

Custom look & feel for browser windows:
http://www.meadroid.com/wpm/
MeadCo HTML printing article and samples on the MSDN:
http://msdn.microsoft.com/workshop/author/script/dhtmlprint.asp
Advanced HTML printing:
http://www.meadroid.com/scriptx/

0 new messages