主窗体源代码
unit MainFrm;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Menus, ComCtrls, ToolWin;type
TForm1 = class(TForm)
MainMenu1: TMainMenu;
ToolBar1: TToolBar;
ToolButton1: TToolButton;
ToolButton2: TToolButton;
F1: TMenuItem;
fsdf1: TMenuItem;
fsdfsd1: TMenuItem;
fdsfds1: TMenuItem;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end; procedure ShowForm(MainApp: TApplication); stdcall; external 'DLL.dll' name 'ShowForm';
var
Form1: TForm1;implementation{$R *.dfm}procedure Search(Position: Integer);
begin
ShowMessage(IntToStr(Position));
end;procedure TForm1.Button1Click(Sender: TObject);
begin
ShowForm(Application);
end;end.//dll源代码
library DLL;{ Important note about DLL memory management: ShareMem must be the
first unit in your library's USES clause AND your project's (select
Project-View Source) USES clause if your DLL exports any procedures or
functions that pass strings as parameters or function results. This
applies to all strings passed to and from your DLL--even those that
are nested in records and classes. ShareMem is the interface unit to
the BORLNDMM.DLL shared memory manager, which must be deployed along
with your DLL. To avoid using BORLNDMM.DLL, pass string information
using PChar or ShortString parameters. }uses
Windows,
SysUtils,
Classes,
Dialogs,
Forms,
DllFrm in 'DllFrm.pas' {ChildForm};{$R *.res}var
DllApp: TApplication;procedure ShowForm(MainApp: TApplication); stdcall;
begin
if not Assigned(DllApp) then
begin
DllApp := Application;
Application := MainApp;
end; Application.CreateForm(TChildForm, ChildForm);
end;procedure DllEntryPoint(dwReason: Integer);
begin
if dwReason = DLL_PROCESS_DETACH then
begin
if Assigned(DllApp) then
Application := DllApp;
end;
end;exports
ShowForm;begin
DllProc := @DllEntryPoint;
end.
unit MainFrm;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Menus, ComCtrls, ToolWin;type
TForm1 = class(TForm)
MainMenu1: TMainMenu;
ToolBar1: TToolBar;
ToolButton1: TToolButton;
ToolButton2: TToolButton;
F1: TMenuItem;
fsdf1: TMenuItem;
fsdfsd1: TMenuItem;
fdsfds1: TMenuItem;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end; procedure ShowForm(MainApp: TApplication); stdcall; external 'DLL.dll' name 'ShowForm';
var
Form1: TForm1;implementation{$R *.dfm}procedure Search(Position: Integer);
begin
ShowMessage(IntToStr(Position));
end;procedure TForm1.Button1Click(Sender: TObject);
begin
ShowForm(Application);
end;end.//dll源代码
library DLL;{ Important note about DLL memory management: ShareMem must be the
first unit in your library's USES clause AND your project's (select
Project-View Source) USES clause if your DLL exports any procedures or
functions that pass strings as parameters or function results. This
applies to all strings passed to and from your DLL--even those that
are nested in records and classes. ShareMem is the interface unit to
the BORLNDMM.DLL shared memory manager, which must be deployed along
with your DLL. To avoid using BORLNDMM.DLL, pass string information
using PChar or ShortString parameters. }uses
Windows,
SysUtils,
Classes,
Dialogs,
Forms,
DllFrm in 'DllFrm.pas' {ChildForm};{$R *.res}var
DllApp: TApplication;procedure ShowForm(MainApp: TApplication); stdcall;
begin
if not Assigned(DllApp) then
begin
DllApp := Application;
Application := MainApp;
end; Application.CreateForm(TChildForm, ChildForm);
end;procedure DllEntryPoint(dwReason: Integer);
begin
if dwReason = DLL_PROCESS_DETACH then
begin
if Assigned(DllApp) then
Application := DllApp;
end;
end;exports
ShowForm;begin
DllProc := @DllEntryPoint;
end.
解决方案 »
- cxgrid的小问题.
- 新人,初中未毕业,准备学习DELPHI
- 如何获取系统的硬盘ID号?
- DELPHI的ADO组件获取的tablename没有包含scheme的麻烦
- 一个关于SDI的问题!
- 想做一bitbtn組件,該組件設計好後,按組件click能動態調用一表單,該表單的主要作用是查詢database任意sql表任意field,
- 如何存储bmp图像?
- 高手请进:::winsocket编程问题!!十万火急!!SOS!!
- “谁能让这个问题到此为止?”+“救救我吧!”——一个并不简单的简单的删除数据的问题。
- 100求程序员考试怎么考?在那里报名?(20分没人理?)
- image.pictrue.loadfromfile的问题
- 存储过程中的一个语法问题
我现在的这个dll是可以供vb使用的,不知道菜单合并有没有用