互斥对象的使用示例

var
  hMutex: HWND;
  Ret: integer;

begin
  Application.Initialize;
  Application.Title := '神迹之光-免费测试版';
  hMutex := CreateMutex(nil, False, '传奇外挂 酷酷神仙版');
  Ret := GetLastError;
  if Ret <> ERROR_ALREADY_EXISTS then
  begin
    Application.CreateForm(TFrmMain, FrmMain);
    Application.Run;
  end
  else
    ReleaseMutex(hMutex);
end.

posted @ 2006-07-20 17:18  云水浮萍  阅读(253)  评论(0编辑  收藏  举报