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

How to use Activex event in javascript?

219 views
Skip to first unread message

bucher

unread,
Sep 27, 2009, 10:30:33 PM9/27/09
to
Hi,

I want to use activex event in javascript.
Here is my htm:

<HTML>
<HEAD>
<TITLE>Scriptable ActiveX Web Control</TITLE>
</HEAD>
<BODY>
<script for=ATLEvent event=ExecutionOver(result) language="Javascript">
alert(result);
</script>
<OBJECT ID="ATLEvent" CLASSID="CLSID:5B898DEC-8172-4B6D-BF1C-FCEF7B517090">
</OBJECT>
</BODY>
</HTML>
<SCRIPT LANGUAGE="JavaScript">
ATLEvent.Add(1, 2);
</SCRIPT>

The activex is simple. It's an atl com dll project. It has an interface
named IXMath and an implemented connect point. The activex project was
downloaded from http://www.codeproject.com/KB/atl/ConnectionPoint.aspx .

I have searched many internet titles. I can't find what's the mistake.
Please let me know where is the mistake.

Thanks in advanced.


Igor Tandetnik

unread,
Sep 27, 2009, 11:44:59 PM9/27/09
to
bucher wrote:
> I want to use activex event in javascript.
>
> I have searched many internet titles. I can't find what's the mistake.
> Please let me know where is the mistake.

So, what exactly is the problem? You never actually mentioned that. On a
hunch, see if this helps:

http://support.microsoft.com/kb/200839

--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925


bucher

unread,
Sep 28, 2009, 3:19:52 AM9/28/09
to
Thank for you reply. I forgot the problem. My problem is the activex dll
can't fire the javascript event code. After I added the IProvideClassInfo2
interface support, the dll can fire the javascript event.

But now I have another problem. I want to create a thread in activex, and
fire the event in the thread just before thread exit. The activex can't fire
the event.

Here is my thread code:
CThreadParam* threadParam = (CThreadParam*)pParam;
auto_ptr<CThreadParam> paramPtr(threadParam);

HRESULT hr =
threadParam->pThis->HttpDownFile(threadParam->m_strRemote.c_str(),
threadParam->m_strLocal.c_str());
threadParam->pThis->Fire_DownloadComplete(hr,
threadParam->pThis->m_bstrInfo, threadParam->pThis->m_bstrDesc);

threadParam->pThis is the pointer of Component class.

Does it matter with thead model?

"Igor Tandetnik" <itand...@mvps.org> д����Ϣ����:%236nYQ4%> So, what

Igor Tandetnik

unread,
Sep 28, 2009, 7:52:31 AM9/28/09
to
bucher wrote:
> But now I have another problem. I want to create a thread in activex,
> and fire the event in the thread just before thread exit.

Have the thread post a custom message to the control's window, and fire
the event from that message's handler. You can't easily fire events
directly from the worker thread.

Brian Muth

unread,
Sep 28, 2009, 2:27:40 PM9/28/09
to

padala...@gmail.com

unread,
May 6, 2014, 2:46:30 PM5/6/14
to
Hi Igore,

my application needs the second thread to fire the events. because here first thread is essentially IE's so i canot block it.
i am facing the same issue as Bucher faced.

Can you guide me how to fire events from the second thread?
0 new messages