How to check if a process is running using Delphi?

前端 未结 5 1759
孤独总比滥情好
孤独总比滥情好 2020-12-31 05:19

Similar to this question, but in Delphi:

How do I find out if a process is already running using c#?

I have an updater program, I want it to check the progra

5条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-31 05:33

    I' m typing these codes initialization part of main unit.

    initialization
    mHandle := CreateMutex(nil, True, 'myApp.ts');
    if GetLastError = ERROR_ALREADY_EXISTS then
    begin
      MessageDlg('Program already running!', mtError, [mbOK], 0);
      Halt;
    end;
    

提交回复
热议问题