PDA

Click to See Complete Forum and Search --> : activex dll doesn't survive after initialize


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?

c@lle
Oct 18th, 2007, 01:46 AM
:confused:

c@lle
Oct 24th, 2007, 08:50 AM
nobody who can help me on this topic?

what part of the question is not clear? i can run the activex dll from a visual basic exe and that works. then i can instantiate the object (and call thus the initialize function), then call the helloworld function and when the object get out of scope it is terminated...

but when used via internet explorer it gets initialized, then immediately terminated and then throws an error when calling the helloworld function??