Using interface in Visual Basic
From: hawkon (hawkon_at_discussions.microsoft.com)
Date: 07/11/04
- Previous message: J French: "Re: centering a form"
- Next in thread: hawkon: "Samples using "Implements" in vb6"
- Reply: hawkon: "Samples using "Implements" in vb6"
- Reply: hawkon: "Samples using "Implements" in vb6"
- Reply: hawkon: "Sampels using "Implements" in VB6"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 11 Jul 2004 07:04:01 -0700
Hi,
I've been reading in MSDN about using Interfaces with Visual Basic (oop similar programming). I have created a vb project based on a sample I found.
I have made one class with definitions (IDog) :
' IDog expresses behavior of a dog object
Public Property Get Name() As String
End Property
Public Property Let Name(ByVal Value As String)
End Property
Public Sub Bark()
End Sub
Public Sub RollOver(ByVal Rolls As Integer)
End Sub
Public Function MyTest()
End Function
On properties for this class I have put Instancing = PublicNotCreatable.
I have made another class with code for this functions. Goes like this :
Option Explicit
Implements IDog
Private Name As String
Private Property Let IDog_Name(ByVal Value As String)
Name = Value
End Property
Private Property Get IDog_Name() As String
IDog_Name = Name & "_test"
End Property
Private Sub IDog_Bark()
' implementation
End Sub
Private Sub IDog_RollOver(ByVal Rolls As Integer)
' implementation
End Sub
Private Function IDog_Mytest()
IDog_Mytest = "Testing this..."
End Function
And finally a asp file calling the dll :
set objTestCom = Server.CreateObject("MyServer.IDog")
Response.Write objTestCom.MyTest()
objTestCom.Name = "JHA"
a = objTestCom.Name
response.write a
Response.End
In Visual Interdev everything seems to work since a popup box with mehods appears on the instance of the dll object. But the only thing I get is an error saying :
Cannot launch out of process component
/testweb/Default.asp, line 18 (Server.Createobject line)
Only InProc server components should be used. If you want to use LocalServer components, you must set the AspAllowOutOfProcComponents metabase setting. Please consult the help file for important considerations.
To correct this I've tried to insert :
<%
Set WebServObj = GetObject("IIS://LocalHost/W3svc")
WebServObj.Put "AspAllowOutOfProcComponents", True
WebServObj.SetInfo
%>
But then I get that access denied on the first line with the GetObject.
So therefore I'd like to know know what I have to do to make vb components with interfaces work in ASP applications.
In advance thanks a great deal for your help!!
Kind regards,
Jon Haakon
-- ------------------------------ Jon Haakon Ariansen System Consultant
- Previous message: J French: "Re: centering a form"
- Next in thread: hawkon: "Samples using "Implements" in vb6"
- Reply: hawkon: "Samples using "Implements" in vb6"
- Reply: hawkon: "Samples using "Implements" in vb6"
- Reply: hawkon: "Sampels using "Implements" in VB6"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|