After we created a DLL file in the previous tutorial, now we’re going to use this DLL file in an application. First, you have to create a user interface like picture below :
Or you can download this project here.
Before you write some codes in this project, you have to make sure that the DLL file you’re going to use and your project are in the same directory (folder). Or you can put the DLL file you’re going to use in directory : c:\windows\system.
To use functions in a DLL file we’ve created, you must type the function after {$R *.DFM}
{$R *.DFM}
{ place functions from DLL here }
function area(length, width : integer): integer; stdcall; external 'area_volume.dll';
function volume(length, width, height : integer): integer; stdcall; external 'area_volume.dll';
external clause means that the functions we use (area and volume) are in an external file (area_volume.dll)
To call area function and volume function see the codes below :
procedure TForm1.CalculateAreaButtonClick(Sender: TObject);
var
L, W : integer;
begin
L := StrToInt(Edit1.Text);
W := StrToInt(Edit2.Text);
Label8.Caption := Label8.Caption + ' ' + IntToStr(area(L,W));
end;
procedure TForm1.CalculateVolumeButtonClick(Sender: TObject);
var
L, W, H : integer;
begin
L := StrToInt(Edit3.Text);
W := StrToInt(Edit4.Text);
H := StrToInt(Edit5.Text);
Label9.Caption := Label9.Caption + ' ' + IntToStr(volume(L,W,H));
end;
area(L,W) and volume(L,W,H) will return integer type values, so if you want to put these values into label.caption, you have to convert them into string using IntToStr() procedure.
You can download the complete code here.
salam balik kenal ^__^
ReplyDeleteIjin download kode lengkapnya ya.
ReplyDeleteTFS`frenz :)
mantap langsung download
ReplyDeletesalam kenal sob
moga sukses
@ Aryadevi, kakara, imtikham : thank you very much for dropping by...
ReplyDeletepanjang banget mas tutorialnya...
ReplyDeletehehehe...
tapi makasih bangyak infonya...
Thank you very much for you can share your post,the article content written very well,extremely is worth my study.
ReplyDeleteif you don not have your Cadfile finished we can assist you with creating 3dcadfiles which are necessity to program our sophisticated machinery.
ReplyDeleteusually we do our best to make a quotation within 2-4 days.