View Full Version : HTML: Detecting if your ActiveX object has launched
Raptisoft
08-25-2004, 07:39 PM
Hi all,
Okay, I'm trying to adapt to Microsoft's insane new SP2 ActiveX stuff, sigh. What I need to do is run some javascript AFTER my ActiveX object gets downloaded.
I've tried a couple "typeof" statements, just running over and over again, but they always tell me they're undefined.
Does anyone have a good javascript code snippet for determining if an ActiveX object has downloaded?
Thanks!
gmcbay
08-25-2004, 07:48 PM
Haven't actually tried this since its been a while since I've done ActiveX programming, but what about calling some dummy method on the ActiveX object and putting the call in a JavaScript try {} catch block? When it doesn't throw an exception, the ActiveX is loaded... maybe?
Raptisoft
08-25-2004, 08:48 PM
Hm... I just spent the last x amount of time trying this. This dummy functions is *always* considered undefined, so I assume I'm exporting it improperly or something.
gmcbay
08-25-2004, 11:08 PM
Are you sure you're putting the method in the ActiveX object's IDL file? If not it won't get exported to the outside world.
Have you tried viewing the ActiveX's typelib using the "OLE/COM Object Viewer" that lives under Visual Studio's "Tools" menu? It should show you what methods are registered for that control, so you can check to see if the one you're trying to call is there...
Also, I'd try putting the control in the ActiveX Control Test Container (same place, under the Tools menu) and try invoking the method from there... Then you at least know if its a JavaScript thing or a problem with the control...
(The above assumes you're using Visual C++)
Raptisoft
08-26-2004, 04:58 AM
I got it. I was adding the function manually. When I add it with the class wizard, it works... though a file compare on the two versions reveals no differences. That's definitely one of the things I hate about visual studio.
vBulletin v3.6.0, Copyright ©2000-2008, Jelsoft Enterprises Ltd.