How some programs can be executed any times you want but some can't? For example each time you open internet explorer, it opens a new process. But some programs don't behave this like, for example Midtown Madness or Yahoo messenger. They can only be executed once.
I want to write a program in this way.
There is also (maybe) more advanced mechanism, when opening Office Word, more than once, it is like pressing New in File menu.
One way to do so is to write something somewhere (in a file or win reg) and set it at first execution, then from that time on, program can check that to see it should be executed or not. But I think this technique is not safe, because anybody can change that value to fool the program. It needs an OS function to prevent this. For example when foo.exe executed for the first time, it will tell OS not to execute a process with this name again (or something like that). Now it needs an advanced hacker to fool the program. Is there any function in Win32 API?
When the program starts it should check to see if there is another instance of itself already running. On a quick search I found this site: http://www.clearnight.com.au/cnspi.htm