unit MediaInfoDll;
interface
uses
{$IFDEF WIN32}
Windows, Messages;
{$ELSE}
Wintypes, Messages, WinProcs;
{$ENDIF}
Const
szNameDLL = '
MediaInfo.DLL';
szNameMediaInfo_Open = '
MediaInfo_Open';
szNameMediaInfo_Get = '
MediaInfo_Get';
szNameMediaInfo_Close = '
MediaInfo_Close';
dll_notloaded = '
DLL nicht geladen.';
noentry = '
Keinen Eintrittspunkt für die Funktion gefunden!';
Type
TFNMediaInfo_Open =
function (File__: PChar): Cardinal
cdecl {$IFDEF WIN32} stdcall {$ENDIF};
TFNMediaInfo_Get =
function (
Handle: Cardinal;
StreamKind: Integer;
StreamNumber: Integer;
Parameter: PChar;
KindOfInfo: Integer;
KindOfSearch: Integer): PChar
cdecl {$IFDEF WIN32} stdcall {$ENDIF};
TFNMediaInfo_Close =
procedure (
Handle: Cardinal)
cdecl {$IFDEF WIN32} stdcall {$ENDIF};
var
MediaInfo_Open : TFNMediaInfo_Open;
MediaInfo_Get : TFNMediaInfo_Get;
MediaInfo_Close : TFNMediaInfo_Close;
hDlg: HWND;
Procedure GetEntryPoints;
implementation
Function WhatIfNoEntry: Integer;
begin
MessageBox(hDlg, @NoEntry[1],
nil, 0);
end;
Procedure GetEntryPoints;
var
lib:THandle;
begin
lib := LoadLibrary(@szNameDLL[1]);
case lib = 0
of
TRUE:
begin
@MediaInfo_Open := @whatifnoentry;
@MediaInfo_Get := @whatifnoentry;
@MediaInfo_Close := @whatifnoentry;
messagebox(0, @dll_notloaded[1],
nil, 0);
end;
else
begin
@MediaInfo_Open := GetProcAddress(lib, @szNameMediaInfo_Open[1]);
if not Assigned(MediaInfo_Open)
then @MediaInfo_Open := @whatifnoentry;
@MediaInfo_Get := GetProcAddress(lib, @szNameMediaInfo_Get[1]);
if not Assigned(MediaInfo_Get)
then @MediaInfo_Get := @whatifnoentry;
@MediaInfo_close := GetProcAddress(lib, @szNameMediaInfo_Close[1]);
if not Assigned(MediaInfo_Close)
then @MediaInfo_Close := @whatifnoentry;
end;
end;
end;
end.