I am having a great deal of difficulty accessing a method on a very simple
activex object that I created using Visual Studio 2003.
In a new project, I chose "MFC Active X Control" from the templates. For
control settings (1) turned "activates when visible" off (2) turned
"invisible at runtime" off (3) turned "has about Dialog" off and (3)
turned
"windowless activation" on.
Next, I used the "Add Method" wizard to add a method. It is very a simple
method with no arguments and returns BSTR.
I modified the implementation of the new method to return a simple string
"Hello" World".
The project compiles without errors. Further, I can execute the method
using the "ActiveX Control Test Container". I see "Hello World" in the
return value box.
Next, I move the control over to an application server on my local
network.
On the application server, I create a simple html file with an object tag.
For class id, I put the value that I see when I search for "quizspk.ocx
Control". (note quizspk.ocx is the name of my control.) This matches the
class id that I see when I view to object in the "OLE/Com Object Viewer"
found under Tools.
Next, I unregister the control so that there are no conflicts when I use
it
in my HTML page. The object tag in my html page pulls the active X object
down from my web server. Also, I set IE security settings to their lowest
level before I test the html and embedded javascript.
When I open up IE Browser and access the html file on my web server, the
activex component is installed and registered on my pc. When my java
script
tries to access the method, I get the error: "Object Doesn't sup****t this
property or method".
I have experimented with many combinations of security settings and
changes
to the code. The list is too exhaustive to put into this message. But, I
appreciate if anyone can give me some constructive ideas on how I should
troubleshoot this.
Here is the html:
<html xmlns="http://www.w3.org/1999/xhtml"
xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
<title>testWS</title>
</head>
<body bgcolor="#ffffff">
<object id="testactive"
classid="clsid:9C36E94E-D44D-427D-A5A5-1780C00F2A75"
codebase="http://tap02a.ckint.com:8887/quizspk.ocx">
</object>
<script language="JavaScript">
function testSpeech() {
var ret;
alert("call testactive.basicTest");
ret = testactive.basicTest();
alert("ret=" + ret);
}
</script>
<form id="test" method="post" action="x">
<input id="test" type="button" value="test" onclick="testSpeech()"
/>
</form>
</body>
</html>
Thanks


|