Application extension
Previous  Top  Next

The application extension supplied with the Jeanie package allows programmers to access the movements of the users choice. This is a fully documented set of calls that can be made to the JeanieTools.dll.

These calls include library selection, movement selection, movement details and descriptions.

The programmer can use a single and simple call to have the user select the movement of their choice. The full details of that movement can be obtained and a file containing the movement in the programmer's required format can be requested.

The libraries and movements can be iterated through and selected under programmer control.

A key issue is the availability and location of the JeanieTools.dll file. This file is installed with the Jeanie movement manager software. The user of any scoring software will need Jeanie installed on their machine for the scorer program to have access to the DLL and the movements in Jeanie.

It is possible to have the JeanieTools.dll placed in the directory of the scorer and use static (direct) calls to the required entry points in the DLL. This is inconvenient to the author of the scorer and the user whenever an update of software should take place. Therefore it is recommended the JeanieTools.dll is called using dynamic Windows calls. At run-time the DLL will need to be located and attached to the scorer so the the entry points in the DLL may be called seamlessly.

The key Windows API calls are (as described in the Windows SDK):

The LoadLibrary function maps the specified executable module into the address space of the calling process.  
HINSTANCE LoadLibrary(  
LPCTSTR lpLibFileName    // address of filename of executable module
);

The GetProcAddress function returns the address of the specified exported dynamic-link library (DLL) function.  
FARPROC GetProcAddress(  
HMODULE hModule,      // handle to DLL module
LPCSTR lpProcName    // name of function
);

BOOL FreeLibrary(  
HMODULE hLibModule    // handle to loaded library module
);   
   
 
To use LoadLibrary you need to know where the DLL is placed. The DLL is found in the directory where the Jeanie software is installed. The installation of Jeanie places this location in the registry for you to find dynamically.  
 
It is found in the registry in the HKEY_LOCAL_MACHINE\Software\ASEComputing\ASE_movements\Path  
This string value contains the full path to the JeanieTools.dll file.

The Pascal code to locate the DLL is:

//This function returns the path to the JeanieTools.dll file.
//If Jeanie is not installed it will not be found and an empty string is returned.

function GetSysPath: string;  
var
  Reg: TRegistry;
begin
  Reg := TRegistry.Create;
  try
    Reg.RootKey := HKEY_LOCAL_MACHINE;
    if Reg.OpenKey('\Software\ASEComputing\ASE_movements'
, False) then
                         //NOTE: false means do not create if not there

        result := Reg.ReadString('Path'
)
    else
       result := ''
;
  finally
    Reg.CloseKey;
    Reg.Free;
  end;
end;

//The scoring program can call this function to check if Jeanie is installed and then use the DLL entry points
//established here. Once the program finishes with the DLL you should call FreeLibrary.
//See the full Pascal code for all the details.

function JeanieInstalled: boolean;
var
  s: string;
begin
  s := GetSysPath;
  if s <> ''
 then
     if FileExists(s + '\JeanieTools.dll'
then
     begin
       JeanieDLL := LoadLibrary(PChar(s + '\JeanieTools.dll'
));
       if JeanieDLL <> 0
 then
          begin
           PickMovement := GetProcAddress(JeanieDLL, 'PickMovement'
);
           ExportMovement := GetProcAddress(JeanieDLL, 'ExportMovement'
);
           GetDetails := GetProcAddress(JeanieDLL, 'GetDetails'
);
//any other entry points just define here

           Result := True;
          end
       else
         result := false;
     end
     else
         result := false
  else
     result := false;
end;