c@lle
Oct 16th, 2007, 04:15 AM
i'm trying to create an activex dll class.
(new project, activex dll)
then i add following functions:
Option Explicit
Private Sub Class_Initialize()
MsgBox "Initialize"
End Sub
Private Sub Class_Terminate()
MsgBox "Terminate"
End Sub
Public Function HelloWorld()
MsgBox "Hello World"
End Function
and i save this project.
i create the dll (file - make project1.dll)
then i call the dll via a html page:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Page title</title>
<script language="JavaScript" type="text/javascript">
oDLL = new ActiveXObject("Project1.Class1");
oDLL.HelloWorld;
</script>
</head>
<body>
<a href="javascript:x();">blabla</a><br />
</body>
</html>
the line with 'new' creates the initialize message, then immediately the terminate message and then an error 'automation server can't create object'...
the object is instantiated, but doesn't life long enough to go into the variable oDLL and to call the hellowordl function?
what's going wrong?
(new project, activex dll)
then i add following functions:
Option Explicit
Private Sub Class_Initialize()
MsgBox "Initialize"
End Sub
Private Sub Class_Terminate()
MsgBox "Terminate"
End Sub
Public Function HelloWorld()
MsgBox "Hello World"
End Function
and i save this project.
i create the dll (file - make project1.dll)
then i call the dll via a html page:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Page title</title>
<script language="JavaScript" type="text/javascript">
oDLL = new ActiveXObject("Project1.Class1");
oDLL.HelloWorld;
</script>
</head>
<body>
<a href="javascript:x();">blabla</a><br />
</body>
</html>
the line with 'new' creates the initialize message, then immediately the terminate message and then an error 'automation server can't create object'...
the object is instantiated, but doesn't life long enough to go into the variable oDLL and to call the hellowordl function?
what's going wrong?