Description
Version: 1.6.1
Date: February 7, 2012
Supported IDDEs: Delphi 5/6/7/2007/2009/XE
License: Freeware
If you wish to allow only one instance of your application being run at the certain moment of time, use this
free VCL component for Delphi. TOneInstance is able to catch loading of new instances, and then pass the used command line back to the first instance for processing.
All you have to do is just put the component on your form, then give some codes for the event OnNewInstanceLoad(NewAppHandle: Cardinal; NewCommandLineW: PWideChar). For more information, see the demo.
Screenshot
Downloads
Download the
full source code of TOneInstance (12 KB):
download from loonies.narod.ru
Download the
compiled demo of TOneInstance (165 KB):
download from loonies.narod.ru
Sponsors
Be careful when posting your photos online! The camera pictures usually contain sensitive data such as GPS coordinates, date and time of taking a snap, etc. So we commend you to apply SuperUtils' ExifCleaner and
mass remove EXIF and other metadata from digital images before uploading them -- this will keep you 100% secured.
Frequently Asked Questions (FAQ)
Q: What for is the MaxNewInstances property?
A: Every time as an instance is executed, it tries to send one message Msg_NewParamStr to the first instance. Supposing your application has registered its extension ".abc" on the system. Whenever a user runs an *.abc file, the Windows shell executes your application in a way or others.
For example, your app receives a new parameter from an instance and spends 5 seconds to process a file completely. Then, it is really dangerous if we do not stop multiple instances being activated repeatedly. The property should help you with this case. When a new instance is launched, it will automatically check its sequence number: if the number is greater than MaxNewInstances, the new instance gonna go to auto-shutdown and not send Msg_NewParamStr message to the first one.
Note that negative values for the MaxNewInstances object property enable unlimited number of new instances to be executed. Setting it to 0 (zero) leads to the state when the OnNewInstanceLoad event will never be triggered. Look into the component's source code to get an idea how it exactly works ;-)
Version History
1.6.1 (February 7, 2012) by Loonies Software
- The message of loading a new instance is now added to the Windows Vista UIPI exclusions.
- Added separate packages for Delphi 7, 2007, and XE.
- Enhanced the source code a little bit.
1.5.0 (July 05, 2009) by Guy Freeman
- Added the property MsgTransportTimeout.
1.4.0 (July 02, 2009) by Guy Freeman
The older changelog is unavailable.