MouseSpotter Posted April 16, 2013 Share Posted April 16, 2013 (edited) Hi, I wish to convert my Mouse & Keyboard capture autoit source code into a DLL so that I can lock the DLL into monitoring only the events for it's parent autoit process (i.e. prevent the code from being used as a keylogger). Once done - I then should be able to post this on the forum so that it can be used by the community. I have never coded in C++. I am good at taking examples and extending them to meet my requirements. I have working examples for autoit calling functions in a C++ dll I have created. However, I do not have a working example of an autoit function being called from the dll (via DllCallbackRegister). The example(s) I have found on the forum are incomplete. Could someone be kind enough to create a share a simple DLL that calls back an autoit function (source code of both - I assume all I need is the .h, .cpp & .au3 source) Many thanks in advance Edited April 23, 2013 by MouseSpotter Link to comment Share on other sites More sharing options...
MouseSpotter Posted April 16, 2013 Author Share Posted April 16, 2013 Found a working example: The code I used wasbasicdll.h#define DECLDIR __declspec(dllexport) extern "C" { DECLDIR void OnAutoItFunc(void * func); }basicdll.cpp#include "basicdll.h" extern "C" { typedef int (_stdcall * au3_func)(int,int,int); void _cdecl OnAutoItFunc(void * func) { int ret = 0; if(func) { au3_func MyAu3Func = (au3_func) func; ret = MyAu3Func(10,20,30); } } }basicdd.au3$dll = DllOpen( path to basicdll.dll) Func Myau3Func($a, $b, $c) ConsoleWrite("Myfunc called with a = " & $a & " b = " & $b & " c = " & $c & @LF) Return $a + $b + $c EndFunc $cb = DllCallBackRegister("Myau3Func","int","int;int;int") $pcb = DllCallBackGetPtr($cb) DllCall($dll, "none:cdecl", "OnAutoItFunc","ptr",$pcb) MsgBox(0,0,@error) Leo1906 1 Link to comment Share on other sites More sharing options...
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