Вниз
Скачать: CL | DM;

ЗагрузкаDLL   Найти похожие ветки 

← →
Der Nechk@ssoff ©   (2006-03-23 10:34) [0]

Опять я.Помогите реализовать загрузку функции из длл при нажатии кнопки!Спасибо!

procedure TForm1.N2Click(Sender: TObject);
begin
вот здесь должна быти функция из длл
if OpenpictureDialog1.Execute then
Memo1.lines.LoadFromFile(OpenpictureDialog1.FileName);
progressbar1.Position:=100;
end;


← →
balepa ©   (2006-03-23 10:47) [1]

TGetTime = procedure(var Time: TTimeRec);
 THandle = Integer;
var
 Time: TTimeRec;
 Handle: THandle;
 GetTime: TGetTime;
 ...
begin
 Handle := LoadLibrary("libraryname");
 if Handle <> 0 then
 begin
   @GetTime := GetProcAddress(Handle, "GetTime");

   if @GetTime <> nil then
   begin
     GetTime(Time);
     with Time do
       WriteLn("The time is ", Hour, ":", Minute, ":", Second);
   end;
   FreeLibrary(Handle);
 end;
end;


← →
balepa ©   (2006-03-23 10:50) [2]

Или вот так
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;
function Summ(X,Y:Integer):Integer;StdCall;
var
 Form1: TForm1;

implementation
function Summ; external "DLLName.dll" name "Summ";

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
 r: Integer;
begin
 r:=Summ(10,34);
 Application.MessageBox(PChar(IntToStr(r)), "Результат функции Summ");
end;

end.


← →
Der Nechk@ssoff ©   (2006-03-23 11:04) [3]

эээ...чего-то непонятно...


← →
balepa ©   (2006-03-23 11:10) [4]

Чего непонятно то ?
F1 + LoadLibrary or dynamically loadable libraries
1. динамически
2. Статически



Страницы: 1 вся ветка

Скачать: CL | DM;



Память: 0.45 MB
Время: 0.047 c
3-1139404580
Megabyte
2006-02-08 16:16
2006.04.09
Статистика в БД


2-1143099299
Хрюша
2006-03-23 10:34
2006.04.09
Как можно предварительно просмотреть содержимое RichEdit


15-1142618636
DbGrid
2006-03-17 21:03
2006.04.09
нужна подсказка


15-1142624192
TStas
2006-03-17 22:36
2006.04.09
КАк изменить свои детали


2-1143223464
Дева
2006-03-24 21:04
2006.04.09
Delphi и flesh




   Наверх