Sign in to follow this  
Followers 0
Shafayat

Creating a simple dll to call from AutoIt

9 posts in this topic

I've been searching over and over again but all in vain. I could not find an example (a complete and working one) for creating a dll in Visual c++ 2008 whose function can be directly called from AutoIt. Please, anyone, can you post a complete example dll? I'm just starting to create dlls in c++ and the 2008 is the Ide I'm using.


[Not using this account any more. Using "iShafayet" instead]

Share this post


Link to post
Share on other sites

#2 ·  Posted (edited)

I find that impossible to believe... ANY dll created in any IDE with an exported function call be called from AutoIt (well there might be something weird with .NET dlls, so don't quote me literally :idea:)

You tried and got an error or something? You sure you created your DLL as stdcall versus cdecl?

Edited by wraithdu

Share this post


Link to post
Share on other sites

sorry stupid question and really simple answer but whats wrong with this code?

Func start

HotKeySet("c", click)

$x=-1

Func click()

$x=$x*-1

endfunc

while $x=1

MouseClick("left",740, 400, 1,1000)

Wend

EndFunc

trying to make it click rapidly when i press c and stop clicking when i press c again

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I always export my functions as cdecl functions. It's easier because it avoids the name decoration problems.

extern "C"
{
__declspec(dllexport) int Add(int a, int <img src='http://www.autoitscript.com/forum/public/style_emoticons/<#EMO_DIR#>/cool.png' class='bbc_emoticon' alt='B)' />
{
    return a + b;
}
}

$returned = DllCall("mydll.dll", "int:cdecl", "Add", "int", 12, "int", 43)
MsgBox(0, "", $returned[0]) ; should be 55
Edited by Richard Robertson

Share this post


Link to post
Share on other sites

@zamzam

WTF makes you think your question has anything to do with this topic or is in any way appropriate for this forum?

Share this post


Link to post
Share on other sites

Thanks Richard.

That's exactly what I was doing wrong. My dll was alright. I just didn't use the array. I'm getting stupider, I guess. :idea:

thanks people. Problem solved! :)


[Not using this account any more. Using "iShafayet" instead]

Share this post


Link to post
Share on other sites

@zamzam

WTF makes you think your question has anything to do with this topic or is in any way appropriate for this forum?

He posted it in a bunch of threads. Not only is it an incomplete question, it's annoying in location.

Thanks Richard.

That's exactly what I was doing wrong. My dll was alright. I just didn't use the array. I'm getting stupider, I guess. :idea:

thanks people. Problem solved! :)

Yeah, a lot of people forget that DllCall returns an array. I do it sometimes too.

Share this post


Link to post
Share on other sites

I just didn't use the array. I'm getting stupider, I guess. :graduated:

Share this post


Link to post
Share on other sites

AutoIt Download,Automation Software, AutoIt is a simple tool that can simulate key presses. Directly call external DLL and Windows API functions. AutoIt will also allow you to create some complex Graphical User Interfaces (GUIs).

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