...if you want to detect whether your own app is running from within itself, for example, if you've written a screen saver and need to check whether itself should run or not, use a Mutex. Here's an example, taken from screen saver - this code is put in the DPR file.
var
CmdLine: String;
MutHandle: THandle = 0;
begin
MutHandle := OpenMutex(MUTEX_ALL_ACCESS, False, 'Screen Saver.Boring');
if MutHandle = 0 then
MutHandle := CreateMutex(nil,false,'Screen Saver.Fun')
else Exit;
:
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.