雪
雪狐狸
Unregistered / Unconfirmed
GUEST, unregistred user!
library test;
uses
SysUtils,
Classes,
Unitdll in 'Unitdll.pas' {Form1};
exports
ShowForm;
{$R *.res}
begin
end.
*************************************
unit Unitdll;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Label1: TLabel;
Button1: TButton;
procedure FormShow(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
function ShowForm(AppH : THandle
DllS:TScreen;Name : pchar) : PChar
StdCall;
var
Form1: TForm1;
Usernamechar;
DllH : THandle;
AppS : TScreen;
implementation
{$R *.dfm}
function ShowForm(AppH : THandle;DllS:TScreen
Name : pchar) : PChar;
begin
DllH := Application.Handle;
AppS := Screen;
Application.Handle := AppH;
Screen :=DllS;
Form1 := TForm1.Create(nil);
Username:=Name;
try
Form1.ShowModal ;
finally
Result:=Username ;
Form1.Free;
Application.Handle := DllH;
Screen := AppS;
end;
end;
procedure TForm1.FormShow(Sender: TObject);
begin
Edit1.text:=Username;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Username:=pchar(edit1.Text);
if (Username='0') or (ShowForm(Application.Handle,Screen,Username)='0') then form1.close;
end;
end.
uses
SysUtils,
Classes,
Unitdll in 'Unitdll.pas' {Form1};
exports
ShowForm;
{$R *.res}
begin
end.
*************************************
unit Unitdll;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Label1: TLabel;
Button1: TButton;
procedure FormShow(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
function ShowForm(AppH : THandle
DllS:TScreen;Name : pchar) : PChar
StdCall;
var
Form1: TForm1;
Usernamechar;
DllH : THandle;
AppS : TScreen;
implementation
{$R *.dfm}
function ShowForm(AppH : THandle;DllS:TScreen
Name : pchar) : PChar;
begin
DllH := Application.Handle;
AppS := Screen;
Application.Handle := AppH;
Screen :=DllS;
Form1 := TForm1.Create(nil);
Username:=Name;
try
Form1.ShowModal ;
finally
Result:=Username ;
Form1.Free;
Application.Handle := DllH;
Screen := AppS;
end;
end;
procedure TForm1.FormShow(Sender: TObject);
begin
Edit1.text:=Username;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Username:=pchar(edit1.Text);
if (Username='0') or (ShowForm(Application.Handle,Screen,Username)='0') then form1.close;
end;
end.