Jump to content

DLL Error


dromenox
 Share

Recommended Posts

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 by dromenox
Link to comment
Share on other sites

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 here
RegExp tutorial: enough to get started
PCRE 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

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 here
RegExp tutorial: enough to get started
PCRE 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

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

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

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...