Re: Passing info between a DLL and an app
- From: "battles" <battlesmail@xxxxxxxxxxxxxx>
- Date: 9 Mar 2006 16:47:49 -0800
I am not sure if this will cure the problem. I have had bunches of
problems executing dlls in Delphi. Try executing your dll in a
procedure by itself like the one below. This seems to have cured my
dll execution problems.
procedure TForm1.LoadAndRunDLLProcedure(sDLL, sFunc : string);
type
TFunc_Start = function(pRiseSetLat, pRiseSetLong : string;
RiseSetOffset : real;
RiseOrSetSw, passmmddyyyy: string) : string;
var
Func_Start : TFunc_Start;
hDll : THandle;
FuncPtr : TFarProc;
sMsg : string;
begin
hDll := LoadLibrary( PChar( sDLL ) );
if (hDll > 32) then begin
FuncPtr := GetProcAddress( hDll, PChar( sFunc ) );
@Func_Start := FuncPtr;
if (@Func_Start <> nil) then begin
LabelRise.Caption := Func_Start(CurrencyEditN1.Text,
CurrencyEditW2.Text, -6, 'r',
FormatDateTime('mmddyyyy',
Now));
LabelSet.Caption := Func_Start(CurrencyEditN1.Text,
CurrencyEditW2.Text, -6, 's',
FormatDateTime('mmddyyyy',
Now));
end
else begin
sMsg := 'DLL entry point ' + sFunc + ' not found';
//procedure not found
MessageBox( 0, PChar( sMsg ), 'Error', MB_OK );
end;
FreeLibrary( hDll );
FuncPtr := NIL;
end
else begin
sMsg := 'File ' + sDLL +' not found';
//dll not found
MessageBox( 0, PChar( sMsg ), 'Error', MB_OK );
end;
end;
.
- Follow-Ups:
- Re: Passing info between a DLL and an app
- From: Christakis John
- Re: Passing info between a DLL and an app
- From: Christakis John
- Re: Passing info between a DLL and an app
- References:
- Passing info between a DLL and an app
- From: Christakis John
- Passing info between a DLL and an app
- Prev by Date: Passing info between a DLL and an app
- Next by Date: Re: Passing info between a DLL and an app
- Previous by thread: Passing info between a DLL and an app
- Next by thread: Re: Passing info between a DLL and an app
- Index(es):
Relevant Pages
|