Sign in to follow this  
Followers 0
Lemonsun

DLL calling in autoit

6 posts in this topic

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 " )

Share this post


Link to post
Share on other sites



You can pass parameters to AutoIt and get them with the $CmdLine array

Share this post


Link to post
Share on other sites

You can pass parameters to AutoIt and get them with the $CmdLine array
You can pass parameters to AutoIt and get them with the $CmdLine array

Can you show me examples ?

Share this post


Link to post
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?

Share this post


Link to post
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 " )

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