Great Posted March 3, 2010 Posted March 3, 2010 Hi, Please help. I am working on this for a while. I have created a simple dll in c#(Visual studio 2008 express edition) to Add 2 numbers. When i call this dll using $result = DllCall("Adddll.dll","none","AdddClass") i receive error 3 "Dll Function not found" $dll= @WindowsDir & '\Adddll.dll' $result = DllCall($dll,"int","AddingValues") If @error = 1 Then MsgBox(0,"ERROR","Unable to use the DLL file.") If @error = 2 Then MsgBox(0,"ERROR","Unknown return type.") If @error = 3 Then MsgBox(0,"ERROR","Function not found in the DLL file.") 1. Do i have to include any files 2. what is wrong in the dll call 3. Is it possible to call c# dll using autoIt I copied the Adddll.dll in c:\Windows drive. Below is my c# code using System; using System.Text; using System.IO; namespace Adddll { public class AddClass { public AddClass() { } public int AddingValues() { int a = 10; int b = 20; int c = a + b; String outputFile = "c:/ocr/outputValue.txt"; TextWriter tw = new StreamWriter(outputFile); tw.WriteLine©; tw.Close(); return c; } } }
Beege Posted March 3, 2010 Posted March 3, 2010 Im not sure but here you call function "AdddClass" $result = DllCall("Adddll.dll","none","AdddClass") I don't see that anywhere in your code.. Assembly Code: fasmg . fasm . BmpSearch . Au3 Syntax Highlighter . Bounce Multithreading Example . IDispatchASMUDFs: Explorer Frame . ITaskBarList . Scrolling Line Graph . Tray Icon Bar Graph . Explorer Listview . Wiimote . WinSnap . Flicker Free Labels . iTunesPrograms: Ftp Explorer . Snipster . Network Meter . Resistance Calculator
PsaltyDS Posted March 3, 2010 Posted March 3, 2010 It that just a typo? "Adddll" has three d's in it, but surely "AdddClass" should only have two? Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Great Posted March 3, 2010 Author Posted March 3, 2010 (edited) Thank you for all your quick response. Below is the code with the function AddingValues. $result = DllCall($dll,"int","AdddingValues") i receive error 3 "Dll Function not found". Below is the AutoIt code... $dll= @WindowsDir & '\Adddll.dll' $result = DllCall($dll,"int","AddingValues") If @error = 1 Then MsgBox(0,"ERROR","Unable to use the DLL file.") If @error = 2 Then MsgBox(0,"ERROR","Unknown return type.") If @error = 3 Then MsgBox(0,"ERROR","Function not found in the DLL file.") 1. Do i have to include any files 2. what is wrong in the dll call 3. Is it possible to call c# dll using autoIt Edited March 3, 2010 by Great
Great Posted March 3, 2010 Author Posted March 3, 2010 No, AutoIt cannot directly use a C# dll.What do i have to do to call c# dll?
wraithdu Posted March 4, 2010 Posted March 4, 2010 Probably write a C/C++ dll to call the C# dll function for you and return the result. I don't know C# so I can't give you any more advice.
Richard Robertson Posted March 4, 2010 Posted March 4, 2010 To use a .Net dll, you need to be using a language that targets the .Net framework. It's doable from AutoIt but not simple at all.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now