XJustOne unitXTrayIcons unitXJustOneNotify unit

    This unit contains function: JustOneNotify and class ZJustOneNotifier with single global variable of the class JustOneNotifier, which allows to get notifications about starting of other instances of the applet and obtain in first instance a command line, used to start new instance. It is usual that other instances are not running further and request is performing by the single (first) already running instance of the applet.

function JustOneNotify( const Identifier : String ) : Boolean;

   Call this function AFTER the creting of Applet to test if this instance of the applet is first. It is possible to call it before creating of forms but when JustOneNotifier is running, applet button window is created (You may set Applet.Visible to False to prevent its showing). It is sufficient not to run applet further if False is returned to prevent starting of other instances of the applet.
   Define string parameter what You assume to be unique, e.g. 'My program, what doing something and written at ...'. It is using to create global system mutexes and must be unique.
   If after calling JustOneNotify your applet discoveres that the instance is first, it can continue running and set OnRunInstance : XOnRunInstance event for global object JustOneNotifier : ZJustOneNotifier.
   type XOnRunInstance = procedure( Params : String ) of object;
When assigned event handler is called, it obtaines command line of new instance of the applet in Params parameter.


goto XCL page

goto home page