有这样的控件,你也可以用API,具体怎么做我也查资料了,呵呵。

解决方案 »

  1.   

    你可以在工程的dpr文件中作如下改动:
    program Project1;uses
      Forms,
      Windows,
      SysUtils,
      Unit1 in 'Unit1.pas' {Form1};{$R *.RES}
    var
      hMutex:HWND;
      Ret:Integer;
    begin
      Application.Initialize;
      Application.Title:='Program Run Once Test';
      hMutex:=CreateMutex(nil,False,'Program Run Once Test');
      Ret:=GetLastError;
      if Ret<>ERROR_ALREADY_EXISTS then
      begin
        Application.CreateForm(TForm1, Form1);
        Application.Run;
      end
      else
        Application.MessageBox('本程序已在运行,您不能再次运行本程序!','警告',MB_OK);
      ReleaseMutex(hMutex);
    end.
      

  2.   

    楼楼上的那位,能不能给我说说CreateMutex api函数的功能?