Jump to content

calling dll function


Recommended Posts

how to call this function prams from dll created in delphi i have no idea how to use this function through auto-it

procedure Myfile(FileName : Pchar); stdcall;

DllCall("myfile.dll","long","Myfile","pchar","myfile.jpg")?
Edited by autoitxp
Link to comment
Share on other sites

hi autoitxp, :huh2:

Here's a quick example ;)

library HelloWorld;

uses
  SysUtils,
  Classes,
  Dialogs;

{$R *.res}
Procedure EchoTest(MyMessage:Pchar); stdcall;
begin
ShowMessage(MyMessage)
end;

exports EchoTest;

begin
end.
DllCall("HelloWorld.dll", "none", "EchoTest", "str", "Hello Delphi from AutoIt")

Hope this helps, :alien:

-smartee

Link to comment
Share on other sites

hi again autoitxp ;),

Glad to help :huh2:

Here's another example, this time with both a parameter, and a return value :ph34r:

library HelloWorld2;

uses
  SysUtils,
  Classes;

{$R *.res}
function isOdd(testint: integer):boolean; stdcall;
begin
  Result := ((testint mod 2)=1);
end;

exports isOdd;

begin
end.
Do
    $iRandomInt = Random(1, 100, 1)
    $sAns = " is even."
    $aRet = DllCall("HelloWorld2.dll", "boolean", "isOdd", "int", $iRandomInt)
    If $aRet[0] Then $sAns = " is odd."
Until (MsgBox(65, "Result", $iRandomInt & $sAns) <> 1)

Hope this helps :alien:,

-smartee

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...