Results 1 to 3 of 3

Thread: How to call a function properly on an ActiveX.dll?

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 2016
    Posts
    61

    How to call a function properly on an ActiveX.dll?

    I wrote this code in my class module:

    Public Function ListFiles(strPath As String, Optional Extention As String)

    Dim File As String

    If Right$(strPath, 1) <> "\" Then strPath = strPath & "\"

    If Trim$(Extention) = "" Then
    Extention = "*.*"
    ElseIf Left$(Extention, 2) <> "*." Then
    Extention = "*." & Extention
    End If

    File = Dir$(strPath & Extention)
    Do While Len(File)
    Form1.List1.AddItem File
    File = Dir$
    Loop
    End Function

    And these on my mainform:

    Dim x As MyClass
    Private Sub Command1_Click()
    Set x = New MyClass
    x.ListFiles "C:\Users\Public\Music\Sample Music", ""
    End Sub

    It works fine, but when i transferred it to activeX.dll and having referred to it and add the ff:

    Dim x As MyDLL.MyClass
    Private Sub Command1_Click()
    Set x = New MyDLL.MyClass
    x.ListFiles "C:\Users\Public\Music\Sample Music", ""
    End Sub

    It's giving me an error Object required... My object=nothing... Having problem with this line x.ListFiles "C:\Users\Public\Music\Sample Music", "" when i debug it... I want to resolve why my object=nothing... What am I doing wrong?

  2. #2
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    5,854

    Re: How to call a function properly on an ActiveX.dll?

    Does the ActiveX DLL have forms?
    Because the filenames are added to Form1.List1
    This is not Form1.List1 of the calling application, but Form1.List1 in the ActiveX dll

  3. #3
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    4,382

    Re: How to call a function properly on an ActiveX.dll?

    This translates to the age-old discussion of children not force-feeding their parents, but the other way round: children providing the information, and the parents pulling it.
    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width