hidrau
asked on
Help to create a Dll and pass a string to it.
Hello guys,
I create a simple dll and application that I only call a method and it display "Ā hello world ".
Now I need to create a function where I can pass a string to it and do it display my message, take a look at my code:
Dll created
My application that calls the DLL
Now, I need a simple help from you how to do that, create a correct function and call the function in application passing the value to it.
thanks a lot
alex
I create a simple dll and application that I only call a method and it display "Ā hello world ".
Now I need to create a function where I can pass a string to it and do it display my message, take a look at my code:
Dll created
library DllCrystal;
uses
SysUtils,
Classes,
Dialogs;
{$R *.res}
procedure DllMessage; export;
begin
ShowMessage('Hello world from a Delphi DLL') ;
end;
exports DllMessage;
begin
end.
My application that calls the DLL
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
procedure DllMessage; external 'DllCrystal.dll';
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
DllMessage
end;
end.
Now, I need a simple help from you how to do that, create a correct function and call the function in application passing the value to it.
thanks a lot
alex
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ferruccio Accalai
Can I pass long string to a dll?
Can I have in my function a constant value? I am trying but I am getting error
Can I pass long string to a dll?
Can I have in my function a constant value? I am trying but I am getting error
ASKER
thanks a lot
ASKER