Sampels using "Implements" in VB6

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: hawkon (hawkon_at_discussions.microsoft.com)
Date: 07/13/04

  • Next message: hawkon: "Samples in VB using "Implements""
    Date: Tue, 13 Jul 2004 12:52:07 -0700
    
    

    Okey, so if no one knows the answer here I wounder if
    anybody has any samples I could look at using implements
    in VB 6.0.
    I'm creating a vb activex dll that I want to call from
    Active Server Pages, but I don't have the right syntax in my code
    to make it work.

    Please help me!
    Kind regards,

    Jon Haakon

    -- 
    ------------------------------
    Jon Haakon Ariansen
    System Consultant
    "hawkon" wrote:
    > 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
    

  • Next message: hawkon: "Samples in VB using "Implements""

    Relevant Pages

    • MAPI Emails from Access
      ... I realize this code is quite long, but could someone take a look at the sub ... Private Const mcERR_DOH = vbObjectError + 10000 ... Private mstStatus As String ... Dim db As Database, rs As Recordset ...
      (microsoft.public.access.formscoding)
    • Re: set fontsize with variable
      ... Public Function MsgBoxDLL(Optional strPrompt As String, ... Private m_Prompt As String ... Public Property Let Prompt ... Private Sub cmdButton1_Click ...
      (microsoft.public.vb.general.discussion)
    • Re: Is there a way to prevent a RichTextBox from scrolling?
      ... Private _isRegex As Boolean ... Public Sub New(ByVal thispattern As String, ... Dim entry As tDict ...
      (microsoft.public.dotnet.framework.windowsforms.controls)
    • Re: FileSystemWatcher advice required please
      ... Private ArchiveImport As String ... Private FilesToProcess As ProcessFiles ... Public Sub Main ... Dim NoVersion As New Collection ...
      (microsoft.public.dotnet.framework)
    • Project Error
      ... Private Declare Sub Sleep Lib "Kernel32" ... Dim strDataSrc As String ...
      (microsoft.public.vb.bugs)