Create a DLL in C# for autoit
#1
Posted 12 December 2009 - 01:04 AM
i want to create a C# (or VB.net) DLL and use it in autoit.
I just want my DLL return a large string to my autoit EXE.
I didn't find any tuto about it, is that possible ?
Thanks
#2
Posted 12 December 2009 - 06:08 AM
You can instead create a COM object from your .Net class and use that.
#3
Posted 12 December 2009 - 11:56 AM
my purpose is quite simple i just want to encrypt a large string in a DLL and deserve it to my autoit exe.
Like this :
My DLL :
GetMyString() {
return string
}
My EXE :
Call ("mydll","getMyString")
I know it's not as simple as i could write, but i'm litlle bit lost...
thanks
#4
Posted 12 December 2009 - 10:21 PM
You said you wanted to use C#, so I assume you know enough about Visual Studio to follow this.
[COMVisible(true)] public class MyCOMClass { public string GetMyString(string someparameter) { return someparameter; } }
Compile this to "mydll.dll".
Then call "regasm.exe /codebase mydll.dll".
In AutoIt,
One or more of these steps may need tweaking, but I hope I've at least given you a step in the right direction.
- zpanderson likes this
#5
Posted 01 July 2012 - 03:29 PM
Compile this to "mydll.dll".
Then call "regasm.exe /codebase mydll.dll".
Am I correct in thinking that this will only allow this solution to work on the computer that it's built on?
Edit:
Well I tested this method out and I have it working on 1 pc and not another. I tried using regasm to generate a registry file for use on the second pc but that didn't seem to help. Any advice on how to get this to work on pcs that it wasn't built on?
Thanks!
Edited by zpanderson, 01 July 2012 - 10:58 PM.
#6
Posted 02 July 2012 - 02:01 PM
#7
Posted 03 July 2012 - 03:06 PM
I do have one more question that you might be able to help with. My c# function takes "public static int put(String[] args)" as an input parameter but I can't figure out how to send this through autoit. I tried making an array of strings, but that doesn't work.
I get a COM Error
err.windescription = Type mismatch.
err.number is: 80020005
err.lastdllerror is: 0
err.scriptline is: -1
err.source is:
err.helpfile is:
err.helpcontext is: 4980844
If I change my c# function to "public static int put(String args)". I can send a singular string with no problems.
Regards,
Edited by zpanderson, 03 July 2012 - 03:11 PM.
#8
Posted 03 July 2012 - 06:33 PM
The problem appears to be handling of arrays via COM though. I don't have enough experience in that to say what the problem or solution is.
Edited by Richard Robertson, 03 July 2012 - 06:35 PM.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users




