I use the following code to limit the number of instances of my application:
All is working except that if the application if already running the previous instance if not restaured (if minimized) or not focused.
the following lines don't do their job:
IsIconic returns false even if the previous instance is minimized and SetForegroundWindow is not working at all...
I use Delphi 2009 under Windows XP.