Delphi

The following code provides one example for importing a SeaMAX function into a Delphi 7 project. There may be other more applicable methods depending on the project. This project uses default and has a single button placed on the main form. The following code is the function created for the button's event handler:

delphi7_1.png
Creating a Default Project With Single Button
procedure TForm1.Button1Click(Sender: TObject);
var
handle: Thandle;
maj: Integer;
min: Integer;
rev: Integer;
bui: Integer;
SM_GetVersion: procedure (Major:Pointer; Minor:Pointer; Revision:Pointer; Build:Pointer); stdcall;

begin
handle := LoadLibrary('SeaMAX.dll');
if handle >= 32 then { success }
begin
SM_GetVersion := GetProcAddress(handle, 'SM_Version');

SM_GetVersion(@maj, @min, @rev, @bui);
MessageDlg('Using SeaMAX Version ' + IntToStr(maj) + '.' + IntToStr(min) + '.' + IntToStr(rev)
+ '.' + IntToStr(bui), mtError, [mbOk], 0)
end
else
MessageDlg('Could not open the SeaMAX dll.', mtError, [mbOk], 0)
end;
 
 
Generated on Mon Nov 26 2018.