Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Embed?

Status
Not open for further replies.

ArcGames

Technical User
Joined
Dec 15, 2003
Messages
3
Location
US
I have a WINDOWS application which allows me to use dll's and their functions. What I want to do is embed a listbox or a comboxbox from a dll into the application and use it. The problem is, I do not know how the the source code for the dll should be constructed, however I do know the calling conventions must be either stdcall or cdecl.

How should the source code look for this dll (I use Delphi)?
 
Please, someone help me?
 
To create a simple DLL from Delphi, your project source file should look something like:

Code:
library MyDLL;


uses
  SysUtils,
  Classes,
  Blah, blah, blah

exports
   Function_To_Be_Called_Remotely;

begin
end.


Then in your unit

Code:
unit Blah;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Etc... 

type
  TBlahDLL = class(TWhatever)
    procedure BlahDLLCreate(Sender: TObject);
  private
    { Private declarations }
    procedure pDoStuff;
  public
    { Public declarations }
  end;

var
  BlahDLL: TBlahDLL;

function Function_To_Be_Called_Remotely:Boolean; stdcall;

implementation

uses
  Whatever_Units;

{$R *.DFM}

function Function_To_Be_Called_Remotely: Boolean;
begin
  with BlahDLL do
  try
    Screen.Cursor := crHourGlass;
    Application.Createform(TBlahDLL, BlahDLL);
    BlahDLL.DoStuff;
  finally
    BlahDLL.free;
    Screen.Cursor := crDefault;
  end;
end;

procedure TBlahDLL.DoStuff;
begin
  // Stuff
end;

...

Robertio
Alias: Robbie Calder
Software Developer
urc@walkermartyn.co.uk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top