Verify if Client is already running

I am attempting to not allow multiple instances of the client to run at the same time. I have a shortcut on the Windows desktop that users LOVE to press. This then opens multiple versions of the client, thus creating multiple reports, database entries, etc…

I have tried the following in the STARTUP Global Script:

isClientRunning = fpmi.system.getSystemFlags() & fpmi.system.CLIENT_FLAG
if isClientRunning:
	if fpmi.gui.errorBox("Application is Already Active"):	
		fpmi.system.exit()

I do want to inform the pesky button pusher that there is a reason that the application is not maximised infront of them. I can use just the fpmi.system.exit and that works fine, however I would like to have an error/warning/messagebox inform the operator that this instance will close.

Is there a way to capture the “OK” from fpmi.gui.errorBox?
OR
Is there a better method to accomplish this task.

Thanks.

Also, I do have autologon enabled, so the application will start automatically.

Your script won’t work - it will always return true, even for the first instance of the Client. That flag is set if the currently executing program is a Client, which will always be true, unless you’re in the Desginer.

You could use the fpmi.system.getSessionInfo() to retrieve information about each session that your autologon user has open, but that will be across the entire Gateway, not just that machine…

You can’t have a script wait for the OK of an error box to be pressed, but you could just use a delay to let them read the message by using fpmi.system.invokeLater

Hope this helps,

Carl,

I figured out what to do to rectify the situation. I created a DB entry for “Host Active”. I check its value in the Global Startup Script. If it is already TRUE, then I put up a messageBox. The system waits for response (ok is only option), then exit the system.
If the system is not already active, I set the bit when my Header Window opens in the InternalFrameOpened event. I reset to FALSE when in the Internal FrameClosed event from the same window. It seems to be operating properly. I also enclosed this check within a network IP verification to make sure it only runs on the host machine.

Thanks for your feedback.

Adam