31.05.2011, 09:28
|
|
Let Me Show You
|
|
Регистрация: 30.04.2010
Адрес: Северодвинск
Сообщения: 5,426
Версия Delphi: 7, XE5
Репутация: 59586
|
|
Код:
library Project1dll;
uses
Forms,
Unit1dll in 'Unit1dll.pas' {Form1};
function ShowModal(s: ShortString): Integer;
begin
Form1:=TForm1.Create(nil);
Form1.Caption:=s;
Result:=Form1.ShowModal;
Form1.Free;
end;
exports ShowModal;
begin
end.
Код:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
FShowModal: function (s: ShortString): Integer;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
hLibrary: Cardinal;
begin
hLibrary:=LoadLibrary('Project1dll.dll');
if hLibrary<>0 then
begin
FShowModal:=GetProcAddress(hLibrary, 'ShowModal');
if @FShowModal<>nil then ShowMessage(IntToStr(FShowModal('ShowMessage')))
else ShowMessage('!ShowModal');
FreeLibrary(hLibrary);
end;
end;
end.
__________________
Пишу программы за еду.
__________________
|