hSem: HWND;

hSem: HWND;

 

hSem := CreateSemaphore(nil, 0, 1, 'BeyondERP');
    if (hSem <> 0) and (GetLastError() = ERROR_ALREADY_EXISTS) then
    begin
      CloseHandle(hSem);
      MessageBox(0, pchar('程序有一个已经在运行'), pchar('错误'),mb_iconstop + mb_Ok);
      Exit;
    end;

你可能感兴趣的:(hSem: HWND;)