Hey,
Ok so I am still learning Delphi and stuff and I am at the point on where I would like to try and add GUI Components to be called from my DLL.
These are the steps I know I must do:
1. Start a new DLL Project
2. Add a Form
From there I would guess I make my functions or procedures and declare variables like:
var Button: TButton;
But I can't seem to get it to work. My project continues to crash.
The only successful GUI command (which wasn't really an authentic one) I got to work was the OpenDialog and SaveDialog Commands.
var SaveDialog: TSaveDialog;
I tried using the same methods with other commands, but they failed to work.
At first, I would run DBP and it would just exit out with no error and then I tried to take it to the next step and I thought my DBP compiler self destructed.
I tried learning from this very old post also but it failed to help my needs.
http://forum.thegamecreators.com/?m=forum_view&t=43774&b=18
Using the example code from that post, only worked when I made the form popup. I would like to embedd the components onto the black screen of Dark Basic Pro. I don't want these commands to run off of a popup form.
Can I get full instructions on what I should put in the 'USES Clause' and how I should set up my functions or procedures. Well maybe my string table is messed up too so please add that to the example.
I would greatly appreciate the help.
BTW: I will add my working OpenDialog so you guys can see what I mean.
unit main;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, GlobStruct, OleCtrls;
type
Tmainform = class(TForm)
private
{ Private declarations }
public
{ Public declarations }
end;
var
mainform: Tmainform;
GlobCore: PGlobStruct;
implementation
{$R *.dfm}
{$R cmdtable.res}
Procedure Construct; cdecl;
Begin
End;
Procedure ReceiveCoreDataPtr(GlobCorePtr: PGlobStruct); cdecl;
Begin
GlobCore := GlobCorePtr;
End;
Procedure Destroy; cdecl;
Begin
End;
Function SaveDialog(DBProString, STitle, SFilter: PChar): PChar; cdecl;
var
SaveD: TSaveDialog;
Filename: TFilename;
NewString: PChar;
Begin
SaveD := TSaveDialog.Create(mainform);
SaveD.Filter := String(SFilter);
SaveD.Title := String(STitle);
SaveD.Execute;
Filename := SaveD.FileName;
GlobCore.CreateDeleteString(@DBProString,0);
GlobCore.CreateDeleteString(@NewString, Length(String(Filename))+1);
StrCopy(NewString, PChar(Filename));
Result := NewString;
SaveD.Free;
End;
exports
Construct name '?Constructor@@YAXXZ',
Destroy name '?Destructor@@YAXXZ',
ReceiveCoreDataPtr name '?ReceiveCoreDataPtr@@YAXPAX@Z',
SaveDialog;
end.
Thanks
The Lone Programmer
Mess With The Best, Die Like The Rest.