dromenox Posted September 5, 2014 Share Posted September 5, 2014 (edited) I will create a program and will use AutoIt to make the GUI and C++ to do some things that are not possible in AutoIt. So I was thinking of making a DLL in C++ and call it from AutoIt. I made a simple example to test DLL. Is working properly, but then the AutoIt closes and not show the return. Here are the codes: DLL: #include <windows.h> extern "C" __declspec(dllexport) int MyMsg(char *tit, char *txt); __declspec(dllexport) int MyMsg(char *tit, char *txt) { MessageBoxA(NULL, txt, tit, 0); return 83; // test return } AutoIt: $ret = DllCall ( "MyDLL.dll", "int", "MyMsg", "str", "test_title", "str", "test_msg") ConsoleWrite($ret[0]) ; 83 Edited September 5, 2014 by dromenox Link to comment Share on other sites More sharing options...
JohnOne Posted September 5, 2014 Share Posted September 5, 2014 I suggest you read the help file regarding DllCall, specifically about the calling method/convention. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
dromenox Posted September 5, 2014 Author Share Posted September 5, 2014 (edited) I suggest you read the help file regarding DllCall, specifically about the calling method/convention. I based on it Edited September 5, 2014 by dromenox Link to comment Share on other sites More sharing options...
jchd Posted September 5, 2014 Share Posted September 5, 2014 The keyword here is "cdecl"... This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
dromenox Posted September 5, 2014 Author Share Posted September 5, 2014 Dont worked Link to comment Share on other sites More sharing options...
JohnOne Posted September 5, 2014 Share Posted September 5, 2014 what don't worked? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
dromenox Posted September 5, 2014 Author Share Posted September 5, 2014 The app crash and dont show the return Link to comment Share on other sites More sharing options...
jchd Posted September 5, 2014 Share Posted September 5, 2014 Show the crashing code. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
dromenox Posted September 6, 2014 Author Share Posted September 6, 2014 3221225477 Link to comment Share on other sites More sharing options...
JohnOne Posted September 6, 2014 Share Posted September 6, 2014 Access Violation. Have you ever created and successfully called a dll function from AutoIt? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
dromenox Posted September 6, 2014 Author Share Posted September 6, 2014 Access Violation. Have you ever created and successfully called a dll function from AutoIt? No, it's the first time. The function is being called. The only problem is that after the AutoIt closes. Link to comment Share on other sites More sharing options...
JohnOne Posted September 6, 2014 Share Posted September 6, 2014 AutoIt can close for many reasons, I suspect your problem here is your Dll code, not your AutoIt code. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
trancexx Posted September 6, 2014 Share Posted September 6, 2014 ...So, it's this: $ret = DllCall ("MyDLL.dll", "int:cdecl", "MyMsg", "str", "test_title", "str", "test_msg") ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
dromenox Posted September 6, 2014 Author Share Posted September 6, 2014 ...So, it's this: $ret = DllCall ("MyDLL.dll", "int:cdecl", "MyMsg", "str", "test_title", "str", "test_msg") Perfect! Link to comment Share on other sites More sharing options...
JohnOne Posted September 6, 2014 Share Posted September 6, 2014 Woah, woah! I suggest you read the help file regarding DllCall, specifically about the calling method/convention. The keyword here is "cdecl"... Dont worked What about that then? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
trancexx Posted September 6, 2014 Share Posted September 6, 2014 Perfect! Both others said exactly what to do, I only draw it for you. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
dromenox Posted September 6, 2014 Author Share Posted September 6, 2014 Woah, woah! What about that then? I had put it in the DLL But thanks ! Do not know if it's possible to do, but I want to create a program in AutoIt that serves as a GUI to make hooks into other programs. For example, I would select an open process in my program and when this process run a particular function, like printf, in addition to performing the function normally a function of my program would be called with the parameters of the original function. It would be perfect if this code worked properly since it would only use AutoIt. But as is not working, I wanted to create a DLL in C ++ to the hook. Then I inject a DLL in process with AutoIt. This DLL would be in an infinite loop within the process. When the DLL detect the hook would call a function within my AutoIt program. I can do this? I had put it in the DLL 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