雨
雨林18
Unregistered / Unconfirmed
GUEST, unregistred user!
我编译了一个DLL文件代码如下
主程序代码
library Project1;
{ 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
SysUtils,
Classes,
Unit1 in 'Unit1.pas' {Form1},
Unit2 in 'Unit2.pas' {Form2};
{$R *.res}
begin
end.
窗体一代码
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TForm1 = class(TForm)
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
end.
窗体二代码
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TForm2 = class(TForm)
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
end.
我现在用另一个exe程序掉用他,我在Button1Click事件调用代码如下
procedure TForm1.Button1Click(Sender: TObject);
var
DLLHandle: THandle;
begin
DLLHandle:=LoadLibrary('Project1.dll');
if DLLHandle <> 0 then
begin
我想在这里调用DLL的窗体一;
end;
end;
end;
我想在TForm1.Button1Click 事件里调用窗体一,在从窗体一的Button1Click调用窗体二如何实现!请高手指教,谢谢
主程序代码
library Project1;
{ 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
SysUtils,
Classes,
Unit1 in 'Unit1.pas' {Form1},
Unit2 in 'Unit2.pas' {Form2};
{$R *.res}
begin
end.
窗体一代码
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TForm1 = class(TForm)
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
end.
窗体二代码
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TForm2 = class(TForm)
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
end.
我现在用另一个exe程序掉用他,我在Button1Click事件调用代码如下
procedure TForm1.Button1Click(Sender: TObject);
var
DLLHandle: THandle;
begin
DLLHandle:=LoadLibrary('Project1.dll');
if DLLHandle <> 0 then
begin
我想在这里调用DLL的窗体一;
end;
end;
end;
我想在TForm1.Button1Click 事件里调用窗体一,在从窗体一的Button1Click调用窗体二如何实现!请高手指教,谢谢