We have created an ActiveX program in Visual Basic (6) for one of our gadgets, but while the activex control is running, it's not possible to interact with the gadget. Unfortunately, the ActiveX control runs for around 5 seconds, so I can't see this being such a good idea as an end-user gadget *grin*
Is there a way to make the ActiveX control run asynchronously Does anyone know how to do it in VB6
Thanks in advance for the help.
Andy

ActiveX problem
Haicheng
The fact you need it to "run when it runs" doesn't matter. Just implement a semaphore which your code can check on another timer event. Use ByRef in the VB definition, and just set it to true when your VB code has finished. eg:
var checkTimerID;
function myFunction() {
...
// Clear the semaphore and initialize the timers
semaphore = false;
window.setTimeout(callActiveX, 500);
checkTimerID = window.setInterval(checkSemaphore, 200);
function callActiveX() {
myCOM.myFunction(semaphore);
function checkSemaphore(() {
window.clearTimeout(checkTimerID);
// ActiveX has done it's thing, now do something with the result
The only other solution is to switch to C++ and implement a callback function. Have a look a Bruce's sidebarAlert which uses a callback to call a Javascript function when something happens externally.
Scott Boyd
I'm not too sure... I'll try it again. If it works for you, it should work for me, right BTW, there are keys in HKCR, too - do I need to add those
Andy
Eric George
You mean a timer in the gadget, or a timer in the VB code It wouldn't be practical to add a timer to the gadget. We need the ActiveX control to run when it runs, but still allow access to the gadget.
I'll admit, I'm not really a VB expert. I'll also admit that I wasn't the person who created the ActiveX control and, unfortunately, he's not an expert either. I had the idea of adding a timer to the ActiveX control but I don't really know how to do it and neither does he.
Andy
Kamalkanth Nayak
<root>\Software\Classes
HKCR is a combination of HKLM\Software\Classes with HKCU\Software\Classes overlayed.
Jamie Thomson
Andy
Raniel
D'oh, I wish there were an easier way! thanks for the help, Jonathan, but I think I'm gonna give up on it for a while until I've read some really thick books :)
Andy
jam281
What's the problem Is it failing in both HKCU and HKLM
Pritesh Shah
Another problem, I want my Gadget to check to see if the ActiveX control is registered. I tried your script to register the ActiveX control automatically, Jonathan, but it doesn't seem to work with RC2.
I have a try/catch statement around where I call my ActiveX control, as follows:
try {var activeCon = new ActiveXObject("MyActiveX.Class");
} catch (e) {
System.Debug.outputString(e.message + "-" + e.description);
}
Anyone know what the deal is with that
Andy E
Peejj