No i dalej coś mu nie pasuje, bo wywala access violation :(. Oto kod:
type PoBitmap = TBitmap;
procedure TForm1.Button2Click(Sender: TObject);
var
DLL : THandle; * uchwyt biblioteki
getvis : function:PoBitmap;
Bitmapa : TBitmap;
begin
bitmapa:=tbitmap.Create;
DLL := LoadLibrary(Pchar('visualization.dll')); * laduj biblioteke
try
@getvis := GetProcAddress(DLL, 'getvis'); * laduj procedure
if @getvis = nil then raise Exception.Create('Bład - nie mogę znaleźć proceudry w bibliotece!');
Bitmapa := getvis</sup>;
finally
FreeLibrary(DLL); * wreszcie zwolnij pamiec
end;
canvas.Draw(0, 0, bitmapa);
end;
I biblioteka:
library visualization;
uses
SysUtils, Classes, graphics;
{$R *.res}
type PoBitmap = ^TBitmap;
function getvis : PoBitmap;
var
Bitmapa : TBitmap;
begin
Bitmapa := TBitmap.Create;
bitmapa.Width:=200;
bitmapa.Height:=100;
bitmapa.Canvas.Rectangle(0, 0, 200, 100);
Result := @Bitmapa;
end;
exports
getvis name 'getvis';
begin
end.
Delphi 6
Pozdrówka