Jump to content

DLL calling in autoit


Recommended Posts

Here is my simple dll function in Delphi

FUNCTION DllMessage( aTitle, aMessage : PChar ) : BOOLEAN;
    var
  c: array[0..800] of Char;
begin
StrPCopy(c, aTitle);
  ShellExecute(Application.Handle, 'open', c, nil, nil, SW_NORMAL);

 end;

I just call it by the following code ..

procedure TForm2.Button1Click(Sender: TObject);
begin
    DllMessage('c:\test.doc',' second parameter ');


end;

And what it does is to pass the first parameter to my dll which is (c:\test.doc) and the dll executes the file .

My question is , can i run this DLL with autoit and pass some parameters as well to autoit .

I could not find related examples ....

i tried this , returns 0.and nothing happens ?? Help appreciated ! thanks !

$result = DllCall ( "SimpleMessageDLL", "", "  DllMessage" , "str", "c:\test.doc" , "str","second parameter " )
Link to comment
Share on other sites

$result = DllCall ( "SimpleMessageDLL", "", "  DllMessage" , "str", "c:\test.doc" , "str","second parameter " )

try to use "DllMessage" instead of " DllMessage"

BTW: Why not use Autoit's native ShellExecute() function?

The Auoit functions are great ! . The Purpose is to learn calling delphi DLLs with autoit .

the following two code displays the scripts folder and the first parameter is ignored . :whistle:

DllCall ( "SimpleMessageDLL", "ptr", "DllMessage" , "string", "" , "string","second parameter " )

DllCall ( "SimpleMessageDLL", "ptr", "DllMessage" , "string", "C:\test.doc" , "string","second parameter " )
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...