Home
MB-Ruler Pro Help Prev Page Prev Page
Quickstart
Demo Version / Full Version
Measure Instruments
Define Scale
Triangular Ruler
Coordinate System
Double Cross Hair
Circle (radius)
Circle (3 points)
Ellipse
Polyline
Polygon
Line
Angle (3 points)
Angle (4 points)
Distance Point-to-Line
Measure Window
Auto Calibration
Additional Features
RGB Picker
Screen Cutter
Screen Loupe
Overlay Objects
Remote Interface
Communication
Functions
Hotkeys
Comments from other Users
History
About ...
Homepage

Remote Interface - Communication

Detect the insalled version

MB-Ruler / MB-Ruler Pro stores any information in the registry that are important for other applications. They are stored using the key

HKEY_CURRENT_USER\Software\MB\MB-Ruler
HKEY_CURRENT_USER\Software\MB\MB-Ruler Pro

ein. Application shows the complete filename (including path) and RemoteInterfaceVersion the verions number of the remote interface. It must be 400 (decimal value) or higher.

Checking for a valid version in Delphi:

  reg := TRegistry.Create;
  if reg.OpenKey('Software\MB\MB-Ruler',true) then
  begin
    if (FileExists(reg.ReadString('Application')) and
      (reg.ReadInteger('RemoteInterfaceVersion') >= 400)) then
    begin
      // OK - MB-Ruler - version available
    end;
  end;
  reg.Destroy;

and for MB-Ruler Pro

  reg := TRegistry.Create;
  if reg.OpenKey('Software\MB\MB-Ruler Pro',true) then
  begin
    if (FileExists(reg.ReadString('Application')) and
      (reg.ReadInteger('RemoteInterfaceVersion') >= 400)) then
    begin
      // OK - MB-Ruler Pro - version available
    end;
  end;
  reg.Destroy;

Check the installed version of MB-Ruler

For testing, if MB-Ruler is already running, use the windows API fuction FindWindow with the parameter "MB-Ruler".
If the return value of the function is 0, MB-Ruler must be startet, is the return value is not 0, the return value is the windows handle of MB-Ruler and MB-Ruler can be inittialized.

  MBRulerHandle := FindWindow(nil, 'MB-Ruler');
  if (MBRulerHandle = 0)
  then // MB-Ruler must be starten
  else // MB-Ruler is running and can be initialized

Initialization of MB-Ruler

After the window handle of MB-Ruler has been detecte, MB-Ruler must be initialzied to accept windows messages from other applications. Use the windows API call

SendMessage(MBRulerHandle, WM_MBRULER_GENERELL, GENERELL_ADDCLIENT, GENERELL_ADDCLIENT_WITHOUTLOGING);

After that, MB-Ruler is initialized.
The const are defined in the file uRemoteInterfaceEventCodes.pas which is delivered together with MB-Ruler.

Add on:

If MB-Ruler has to inform the client application about changes of values, your application must call

SendMessage(MBRulerHandle, WM_MBRULER_GENERELL, GENERELL_ADDCLIENT, window handle);

Window handle is the handle of the window, that will receive the messages.

This window must be able to process messages with the ID WM_MBRULER_GENERELL.
During the initialization, the messages

PostMessage(WM_MBRULER_GENERELL, GENERELL_ADDCLIENT, window handle)

is send from MB-Ruler to the client application.
The client application must return the window handle as the result of the call to be add to the message loop of MB-Ruler.

Converted from CHM to HTML with chm2web Pro 2.76 (unicode)