Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ActiveX for dummies

Status
Not open for further replies.

tpeter343

Programmer
Jul 13, 2004
1
US
I am a new ActiveX user. I am attempting to incorporate an ActiveX control into my page. I've been successful at opening and envoking all the Methods on my control. However, my control has an event called DaqUpdate() that it envokes to pass data from the control to the web page. My problem is that I can't seem to get the web page to recognize the event. I know it happens, because the control works in my MSExcel VBScript just fine.

I've implemented the following to react to the event... is this sufficient to react to a ActiveX event or am I missing something? (Obviously I am it doesn't work)

function DaqUpdate(lValueCount, pValues)
{
alert("DaqUpdate Called");
}

Here is the entire HTML page:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Com Object Tester 2</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<script language="JavaScript" type="text/JavaScript">

xDoc = new ActiveXObject("InGenius.DaqCtrl.1");
xDoc.UnregisterAllValues();
xDoc.RegisterValue("Throttle Angle");
xDoc.StartDaq(0);

if (xDoc==null)
{
alert('Error Loading ActivexObject');
}

alert("before function");

function DaqUpdate(lValueCount, pValues)
{
alert("DaqUpdate Called");
}

function closeUI()
{
xDoc.StopDaq();
xDoc.UnregisterAllValues();
}

</script>
<body onunload="closeUI()">
</body>
</html>
 
You made the "DaqUpdate" function but you didn't associate the ActiveX control's event with the function. I'm a little new to ActiveX too, this is how I scripted mine:

Code:
    <OBJECT ID="PlayerRecorderUI"
      CLASSID="CLSID:23E1CDB1-48E9-446D-9544-0FE14CF9A2BC"
      CODEBASE="launchpad.CAB#version=1,0,0,0"
      WIDTH="0" HEIGHT="0"
      >
      <PARAM NAME="RecordControls" VALUE="FALSE">
    </OBJECT>

    <SCRIPT type="text/javascript" for="PlayerRecorderUI"
      event="MinSizeChanged(cx,cy)"> <!--

        width = cx;
        height = cy;

      //-->
    </SCRIPT>

Instead of a Javascript function I have specified an explicit event handler. That's the only way I know how to do it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top