Jump to content

Need help with DLL and DllCall


xwinterx
 Share

Recommended Posts

I am learning C# and trying to make a dll that I can use with an autoit script. I have attached the dll to see if anyone can help me. All it does is return a string value. It works on a console app I made to test it in VS2008, however I get an error that the function is not found in the dll file when I try with autoit. Here is my au3 code:

$dll = DllOpen("ClassLibrary1.dll")

If $dll = -1 Then
    MsgBox(4096, "Error", "Failed to open dll!")
    Exit
EndIf


$info = DllCall($dll, "str", "GetX")

If @error Then
    MsgBox(4096, "Error", "Error: " & @error)
Else
    MsgBox(4096, "Success!", "Return was: " & $info[0])
EndIf


DllClose($dll)
Exit

I am pretty sure it is just my DLL but I don't really know. I may be approaching it wrong.

ClassLibrary1.dll

Link to comment
Share on other sites

so then I need to change the DLL to something unmanaged? was my DllCall atleast right? cuz I am just trying to decide if my error was in the AutoIt or in the DLL. I am assuming that it is in the DLL then and I have to change its type somehow. If so, that way I can go look at other sources for help and not clutter these forums.

Link to comment
Share on other sites

It is possible to export some managed functions, but it is not too easy:

http://www.codeproject.com/KB/dotnet/emilio_managed_unmanaged.aspx?display=Print

In the german forum, someone made a script to do that, but i don't know if it works well.

Still, you need to have the .NET-framework installed to use that DLL.

Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...