Jump to content
Sign in to follow this  
xwinterx

Need help with DLL and DllCall

Recommended Posts

xwinterx

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

Share this post


Link to post
Share on other sites
xwinterx

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.

Share this post


Link to post
Share on other sites
ProgAndy

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

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.