Lemonsun Posted July 19, 2007 Share Posted July 19, 2007 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 More sharing options...
JavaCupiX Posted July 19, 2007 Share Posted July 19, 2007 You can pass parameters to AutoIt and get them with the $CmdLine array Link to comment Share on other sites More sharing options...
Lemonsun Posted July 19, 2007 Author Share Posted July 19, 2007 You can pass parameters to AutoIt and get them with the $CmdLine arrayYou can pass parameters to AutoIt and get them with the $CmdLine array Can you show me examples ? Link to comment Share on other sites More sharing options...
Zedna Posted July 19, 2007 Share Posted July 19, 2007 $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? Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Lemonsun Posted July 19, 2007 Author Share Posted July 19, 2007 $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 . 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 More sharing options...
Zedna Posted July 19, 2007 Share Posted July 19, 2007 Look at _GetLastErrorMessage()Call it after your DllCall() to see error message. Resources UDF ResourcesEx UDF AutoIt Forum Search 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