www.icetips.com  Icetips Utilities Documentation 5/9/2015    

IsProgramRunning

Previous  Top  Next  


Prototype: (String pSemaphoreValue),Byte

 

pSemephoreValueUnique string that identifies the program.  You could use a GUID or any string that you think is completely unique for your program such as 'Icetips ProductName executable' 
ReturnsTrue or false depending on if the program is running or not. 

 

This method is used to determine if a program is already running and then activate the currently running instance of it.  The method uses CreateSemaphore to create a unique handle to the program instance.  If the program is run again, the CreateSemaphore will report that the handle already exists. 

 

This method should be called right after the program CODE statement to prevent any start up code to run.  The handle returned by CreateSemaphore is automatically destroyed when the program terminates. 

 

Example:

Glo:ITW  ITWindowClass

Code

If Glo:ITW.IsProgramRunning('Icetips product')

  Glo:ITW.ActivateWindow('Icetips product appframe')

  Halt()

End

 

Glo:ITW  ITWindowClass

Code

If Glo:ITW.IsProgramRunning('Icetips product')

  Message('Program is already running, cannot run another instance','Program already running')

  Glo:ITW.ActivateWindow('Icetips product appframe'!! Call AFTER the Message()

  Halt()

End

 

 

 

See also:

ActivateWindow

Limit Program Instance

http://msdn.microsoft.com/en-us/library/windows/desktop/ms682438(v=vs.85).aspx



Direct link to this page: http://www.icetips.com/manuals/utilities/isprogramrunning_window.htm