CapeSoft.Com
Clarion Accessories
RunOnce
Documentation
CapeSoft Logo

CapeSoft RunOnce
Documentation

Download Latest Version History FAQ
Installed Version Latest Version


Please Note:

You need NetTalk to use RunOnce in your application.

NetTalk is not included in the RunOnce purchase, so if you don't already own it you will need to purchase it as well.


Description

RunOnce ensures your application only opens in one instance. With a couple of easy steps, your application won't start up twice.

Feature list

Using CapeSoft RunOnce

Add RunOnce to your application in a few Easy Steps!

(For Multi-DLL apps - do this in the mainexe application).

  1. Import the RunOnce_HandleSecondInstance window using the template utility. Open your application in the Clarion IDE, and select (from the Application menu) the Template Utility, and then select one of the following utilities (there's one for ABC and one for legacy):

    Template Utilities
  2. Add the global extension (Global -> Extensions -> Insert -> Activate CapeSoft RunOnce).
  3. On the Options tab of the Global Extension template, enter the port number (use a random number between 2000 and 32000.
  4. Add the RunOnce - Server window Template extension template to your frame window (or another window that stays open continuously. (Procedure properties -> Extensions -> insert and select the RunOnceServer template)
  5. Add NetTalk to this application (in the normal manner as prescribed in the NetTalk docs) if you have not yet added it. (Note: for multi-dll applications, you'll need to add the NetTalk extension to your data dll application as well - if you have not done so already).
For additional options, take a look at the RunOnce templates section of this document.

Problems in implementing RunOnce:

The RunOnce templates

The Global Extension template:



The Application Name is used to register the mutex to identify a unique application. By default this is the name of your application, but you can make it something else if you want to identify more than one exe to the same application name. Use 'Quotes' or a variable for this. If you want to prevent users from running multiple copies of the program (ie first user to run it is ok, but other users fail, then prefix the Application Name with Global\

The RunOnce Procedure is the procedure that is used to handle a second instance of the exe that is run. This procedure will pass focus to the main procedure and send any commandline parameters to the current instance of the application.

The Port number is the winsock port that is used to communicate between the second instance and the first instance of the application. This should be unique (across all applications running) in order to enable communication between both instances of the application.

If your Clarion 6 application will be used in Terminal Server (TS) environment, then you can check the Disable RunOnce for Terminal Server sessions checkbox to disable runonce when your application is running in a TS environment

You can also enter an expression in the Disable RunOnce if prompt that (if evaluates to true) will disable RunOnce at runtime. This means that you can disable or enable runonce for different clients/environments. Use the Global embed point: 'RunOnce - Prime variables to disable RunOnce at runtime' to prime variables used in this expression - before RunOnce is activated at runtime.

If you have additional applications that you want to communicate with (when a second instance starts up), then you can enter them into the list. This is useful for a "close all" type instruction, where you could instruct other applications to close down. The port and application name must match the RunOnce settings of the other application. You can populate the RunOnce - Run Another Application code template at the embed point where you want to this app to call the other application.

The RunOnce Server local extension template

This template is added to a window in your application that is always running. This will handle communications for the first instance of the exe that are received from a second instance.

RunOnce Server Template Options

RunOnce Embed Points

Support and Purchase

CapeSoft Support
Email
Telephone +27 87 828 0123
(087) 828 0123

Version History

Download latest version here

Version 1.12 - 25 May 2021
Version 1.11 - 18 September 2018
Version 1.10 - 25 February 2015 Version 1.09 - 3 February 2014 Version 1.08 - 2 May 2013 Version 1.07 - 10 August 2011 Version 1.06 - 29 March 2010 Version 1.05 - 24 March 2010 Version 1.04 - 10 November 2008 Version 1.03 - 9 October 2008 Version 1.02 - 26 September 2008 Version 1.01 - 25 September 2008 Version 1.00 - 5 September 2008