Mam taki kod dll'ki:
library bmp;
uses
Graphics;
{$R *.res}
function DrawFormat(filename: pchar): TBitmap; stdcall;
begin
Result := TBitmap.Create;
Result.LoadFromFile(filename);
end;
exports
DrawFormat name 'DrawFormat';
begin
end.
Procedura ta otwiera plik bmp i podaje go jako bitmape w funkcji. To taki plugin do przeglądarki graficznej. I teraz mam problem bo w kodzie programu mam taki kod:
if FileExists(ExtractFilePath(Application.ExeName)+'formats\' +ansilowercase(StringReplace(ExtractFileExt(nazwa), '.', '', [rfReplaceAll])) +'.dll') then
begin
DLL := LoadLibrary(PChar(ExtractFilePath(Application.ExeName)+'formats\' +ansilowercase(StringReplace(ExtractFileExt(nazwa), '.', '', [rfReplaceAll])) +'.dll'));
try
@DrawFormat := GetProcAddress(DLL, 'DrawFormat');
try
BMP.Assign(DrawFormat(pchar(nazwa)));
except on Exception do BMP.LoadFromFile(ExtractFilePath(Application.ExeName) +'gfx\\broken-image.bmp');
end;
finally
FreeLibrary(DLL);
end;
end;
i w miejscu assignowania bitmapy w trakcie działania programu wywala błąd: EConvertError!! Pomocy co jest źle!!??