Results 1 to 4 of 4

Thread: Activex DLLs

  1. #1
    Guest

    Arrow

    Having just upgraded to Pro edition i was fiddling around with an activex dll project.

    In order to test my newly compiled DLL i tried to use a standard API call like this:

    Code:
    Public Declare Sub HelloMessage Lib "C:\Windows...\MyNewDLL.dll" ()
    but when I called this sub from a command button, an error message said that it could not find the entry point in the dll for this subroutine.

    The MSDN hasnt helped me much in this respect, but it says something about needing a class module in all activex components.

    the code that i used in the dll subroutine called "HelloMessage" is a simple one to bring up a normal msgbox saying "hello".

    This is just a simple task so that i can get used to the way that dll's work. Once i get this sussed out I can expand, and make my fortune!

    What am I doing wrong?

    Thanks

  2. #2
    Member
    Join Date
    Jan 1999
    Location
    Longmont,CO
    Posts
    53

    Talking

    You can't call an ActiveX DLL like that. What you need to do is start a std exe project and set a reference to your newly compiled COM DLL, (i.e. ActiveX DLL). Look in Project|References and you should see your server name. If you called your project MyNewDLL, you'll see it in your list of available references. Once you've set your reference, you can instantiate classes from your component.

    Dim cMine As MyNewDLL.ClassName

    Set cMine = New ClassName

    cMine.HelloMessage

    Set cMine = Nothing

  3. #3
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    you'll need a reference to your dll


    Code:
    'form code
    Option Explicit
    
    
    Private Sub Command1_Click()
    Dim obj As New mydll.Class1
    
    obj.HelloMessage
    
    
    End Sub
    Code:
    'class1 code
    Option Explicit
    
    Public Sub HelloMessage()
    
    MsgBox "Hello from inside this dll.."
    
    End Sub
    Mark
    -------------------

  4. #4
    Guest

    Doh!

    Ahhh, brilliant thanks guys

    boy, do I feel dumb!

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