There is no way of "disabling" multiple instances of an application.
What most programs that require this behaviour do is use a system
specific mechanism to detect wether the "application" is currently
running and initiate a communication with the other instance to "take over".
One method commonly used is to create a locking file that is kept open
by the application and "locked" (again off topic here) so that if the
application is shut down improperly, it will be automatically be
unlocked by the operating system. Communication can be done using a
named pipe, socket or any other favorite IPC mechanism you want, all
off-topic here.
Nontheless, the code is quite trivial.