CallDll

Blitz3D Forums/Blitz3D Beginners Area/CallDll

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Here is the delphi code:

library FormDLL;

uses
Unit1 in 'Unit1.pas' {Form1};

exports
getfile;

end.


unit Unit1;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;

type
TForm1 = class(TForm)
OpenDialog1: TOpenDialog;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

function getfile (fis: Pchar) : pchar; stdcall;

var
Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
begin
opendialog1.Execute;
end;

function getfile (fis: Pchar) : pchar; stdcall
var
Form1 : TForm1;
begin
Form1 := Tform1.Create (application);
form1.OpenDialog1.Execute;
end;

end.


Here is the Blitzbasic code:

While Not KeyHit(1)

If KeyDown ( 32 )=True Then
s$=CallDLL("i:\programs code\darkpro\testdll\FormDll.dll","getfile")
EndIf

Text 10,130,"Return " + s$
Flip
Wend
End