Restart Delphi Application Programmatically

前端 未结 9 1517
情深已故
情深已故 2021-02-09 06:58

It should not be possible to run multiple instances of my application. Therefore the project source contains:

CreateMutex (nil, False, PChar (ID));
if (GetLastEr         


        
9条回答
  •  温柔的废话
    2021-02-09 07:57

    You could pass a command line argument like "restart" and run a Sleep() before you try to acquire the Mutex or try to acquire the mutex in a loop that sleeps a while.

    Also you could set up communication between both processes, but that might be overkill.

提交回复
热议问题