Cant Get a valid GetProcAddress from a valid DLL
Hi,
I am trying to access some 32 bit DLL functions in the R&R Report
Writer 7.0 RRRPT32.DLL. Here is the code:
{======= Begin Code ========}
Type
TChooseReport = function(lpzAppName:PChar; lpzLibName:PChar;
lSize:Integer; lpzRepName:PChar; rSize:Integer):Integer;
{ other code/definitions.....}
procedure TRREntryForm.SpeedButton2Click(Sender: TObject);
var
LibHandle:THandle;
ChooseReport:TChooseReport;
MyApp,MyLib,MyRpt:PChar;
hRpt: Integer;
begin
MyApp := StrAlloc(65);
MyLib := StrAlloc(65);
MyRpt := StrAlloc(65);
try
LibHandle := LoadLibrary('RRRPT32.DLL');
@ChooseReport := GetProcAddress(LibHandle,'chooseReport');
hRpt := ChooseReport(MyApp,MyLib,65,MyRpt,65);
finally
StrDispose(MyApp);
StrDispose(MyLib);
StrDispose(MyRpt);
end;
end;
end.
{======== End Code ===========}
procedure TRREntryForm.SpeedButton2Click(Sender: TObject);
var
LibHandle:THandle;
ChooseReport:TChooseReport;
MyApp,MyLib,MyRpt:PChar;
hRpt: Integer;
begin
MyApp := StrAlloc(65);
MyLib := StrAlloc(65);
MyRpt := StrAlloc(65);
try
LibHandle := LoadLibrary('RRRPT32.DLL');
@ChooseReport := GetProcAddress(LibHandle,'chooseReport');
hRpt := ChooseReport(MyApp,MyLib,65,MyRpt,65);
finally
StrDispose(MyApp);
StrDispose(MyLib);
StrDispose(MyRpt);
end;
end;
end.
What I am finding is happening is the LoadLibrary is returning a valid
handle to the DLL and is loading the DLL, but the GetProcAddress call
is not returning a reference to the function I want. I have tried a
lot of the other documented functions to no avail. I have verified the
case sensitive issues with Win32 DLLs and have located the function
table in the DLL and matched up the names using DOS debug.
Anyone have any ideas?
Regards,
Darren Forcier
Forcier Computer Services