Sign in to follow this  
Followers 0
shadesdude

Dll problems

3 posts in this topic

Ok so I decided to make my own DLL for some audio stuff I want to do and tried to test out compatibality in auto-it.

This is what the Dll code looks like (in VB) which compiles fine.

Public Class Addnumbers
    Public Number1 As Object
    Public Number2 As Object
    Function Add(ByVal Number1, ByVal Number2)
        Add = Number1 + Number2
    End Function
End Class

Public Class Subnumbers
    Public Number1 As Object
    Public Number2 As Object
    Function Subtract(ByVal Number1, ByVal Number2)
        Subtract = Number1 - Number2
    End Function
End Class

And here is my auto-it code

Func Add()
    $x = 1
    $y = 2
    $result = DllCall("eg104.dll", "int", "Addnumbers", "int", $x, "int", $y)
    if @error = 1 Then
        MsgBox(0x0,"Result","Bad Dll")
    ElseIf @error = 3 Then
        MsgBox(0x0,"Result","Function not found")
    Else
        MsgBox(0x0,"Result",$x &" + "& $y & " = "& $result)
    EndIf
EndFunc

In the Dll call I have tried Addnumbers, Add, and Addnumbers.Add which returns "Function not found" each time. My guess is something with the classes but it's been a while since I have done VB and Java and C++ have melded into one language which is now corrupting other languages. I know I have to be missing something simple but it's been a while since I have blinked and need a fresh pair of eyes.

~Shadesdude

Share this post


Link to post
Share on other sites



Nevermind I was writing an ASP Dll by mistake >.<

Share this post


Link to post
Share on other sites

You can't call functions from within a class without an instance of the class. You need file level functions for AutoIt to call, or COM interfaces.

I don't think VB lets you write file level functions.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0