I have created...
type
//Dll functions
TFunc = function: string; stdcall;
TFunc2 = function(test: string): string; stdcall;
.
.
.
procedure GetDllMethods(Dllname: string; Methods: string);
.
.
.
//call Dll library and metods on the fly
procedure TMainForm.GetDllMethods(Dllname: string; Methods: string);
var
FPointer: TFarProc;
Instance: THandle;
Funk: TFunc;
begin
Instance := SafeLoadLibrary (Dllname);
if Instance <> 0 then //check library
begin
FPointer := GetProcAddress (Instance,
PChar (Methods));
if FPointer <> nil then //check methods exists
begin
Funk := GetProcAddress (Instance,
PChar (Methods));
Funk;
end
else
ShowMessage('Can not find ' + Methods + 'method');
end
else
ShowMessage('Can not find ' + Dllname + 'libary');
end;
My questions have to use the same procedure to call TFunc2 instead of creating same procedure for TFunc2 but use Func: TFunc2 as variable.
Parameter passing or pointing object, something or somehow?
Any help
Many Thanks
m
type
//Dll functions
TFunc = function: string; stdcall;
TFunc2 = function(test: string): string; stdcall;
.
.
.
procedure GetDllMethods(Dllname: string; Methods: string);
.
.
.
//call Dll library and metods on the fly
procedure TMainForm.GetDllMethods(Dllname: string; Methods: string);
var
FPointer: TFarProc;
Instance: THandle;
Funk: TFunc;
begin
Instance := SafeLoadLibrary (Dllname);
if Instance <> 0 then //check library
begin
FPointer := GetProcAddress (Instance,
PChar (Methods));
if FPointer <> nil then //check methods exists
begin
Funk := GetProcAddress (Instance,
PChar (Methods));
Funk;
end
else
ShowMessage('Can not find ' + Methods + 'method');
end
else
ShowMessage('Can not find ' + Dllname + 'libary');
end;
My questions have to use the same procedure to call TFunc2 instead of creating same procedure for TFunc2 but use Func: TFunc2 as variable.
Parameter passing or pointing object, something or somehow?
Any help
Many Thanks
m