2、对DPR文件的改动  

怎样才能禁止同一个程序同时运行program Project1;
怎样才能禁止同一个程序同时运行
怎样才能禁止同一个程序同时运行uses
怎样才能禁止同一个程序同时运行  Forms,
怎样才能禁止同一个程序同时运行  Windows,
怎样才能禁止同一个程序同时运行  Messages,
怎样才能禁止同一个程序同时运行  IniFiles,
怎样才能禁止同一个程序同时运行  SysUtils,
怎样才能禁止同一个程序同时运行  Unit1 in 'Unit1.pas' {Form1};
怎样才能禁止同一个程序同时运行
怎样才能禁止同一个程序同时运行{$R *.res}
怎样才能禁止同一个程序同时运行const
怎样才能禁止同一个程序同时运行  CM_RESTORE = WM_USER + $1000;{自定义''恢复消息''}
怎样才能禁止同一个程序同时运行  MYAPPNAME = 'Project1';
怎样才能禁止同一个程序同时运行var
怎样才能禁止同一个程序同时运行  hExeWnd:THandle;
怎样才能禁止同一个程序同时运行  str: string;
怎样才能禁止同一个程序同时运行  IniFile: TIniFile;
怎样才能禁止同一个程序同时运行begin
怎样才能禁止同一个程序同时运行    try
            IniFile := TIniFile.Create(ExtractFilepath(Application.exename) + 'inifile.ini');
怎样才能禁止同一个程序同时运行 怎样才能禁止同一个程序同时运行   str := IniFile.ReadString('name', 'caption', '');
怎样才能禁止同一个程序同时运行    finally
怎样才能禁止同一个程序同时运行       hExeWnd:=FindWindow(MYAPPNAME,pchar(str));
怎样才能禁止同一个程序同时运行       if hExeWnd > 0  then
怎样才能禁止同一个程序同时运行       begin
怎样才能禁止同一个程序同时运行          PostMessage(hExeWnd,CM_RESTORE,0,0);
怎样才能禁止同一个程序同时运行         Application.Terminate;
怎样才能禁止同一个程序同时运行      end
怎样才能禁止同一个程序同时运行      else
      怎样才能禁止同一个程序同时运行begin
怎样才能禁止同一个程序同时运行         Application.Initialize;
怎样才能禁止同一个程序同时运行         Application.Title := '测试';
怎样才能禁止同一个程序同时运行         Application.CreateForm(TForm1, Form1);
怎样才能禁止同一个程序同时运行         Application.Run;
怎样才能禁止同一个程序同时运行      end;
       end;
怎样才能禁止同一个程序同时运行end.
怎样才能禁止同一个程序同时运行


 
  1、对主窗口程序的改动:


怎样才能禁止同一个程序同时运行unit Unit1;
怎样才能禁止同一个程序同时运行
怎样才能禁止同一个程序同时运行interface
怎样才能禁止同一个程序同时运行
怎样才能禁止同一个程序同时运行uses
怎样才能禁止同一个程序同时运行  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
怎样才能禁止同一个程序同时运行  Dialogs, StdCtrls,IniFiles;
怎样才能禁止同一个程序同时运行 const
怎样才能禁止同一个程序同时运行  CM_RESTORE = WM_USER + $1000;{自定义''恢复消息''}
怎样才能禁止同一个程序同时运行  MYAPPNAME = 'Project1';
怎样才能禁止同一个程序同时运行
怎样才能禁止同一个程序同时运行type
怎样才能禁止同一个程序同时运行  TForm1 = class(TForm)
怎样才能禁止同一个程序同时运行    Button1: TButton;
怎样才能禁止同一个程序同时运行    procedure Button1Click(Sender: TObject);
怎样才能禁止同一个程序同时运行    procedure CreateParams(var Param:TCreateParams); Override;
怎样才能禁止同一个程序同时运行    Procedure RestoreRequest(Var Message:TMessage); Message CM_RESTORE;
怎样才能禁止同一个程序同时运行    procedure FormCreate(Sender: TObject);
怎样才能禁止同一个程序同时运行  private
怎样才能禁止同一个程序同时运行    { Private declarations }
怎样才能禁止同一个程序同时运行  public
怎样才能禁止同一个程序同时运行    { Public declarations }
怎样才能禁止同一个程序同时运行  end;
怎样才能禁止同一个程序同时运行
怎样才能禁止同一个程序同时运行var
怎样才能禁止同一个程序同时运行  Form1: TForm1;
怎样才能禁止同一个程序同时运行
怎样才能禁止同一个程序同时运行implementation
怎样才能禁止同一个程序同时运行
怎样才能禁止同一个程序同时运行{$R *.dfm}
怎样才能禁止同一个程序同时运行
怎样才能禁止同一个程序同时运行procedure TForm1.Button1Click(Sender: TObject);
怎样才能禁止同一个程序同时运行var
怎样才能禁止同一个程序同时运行  str: string;
怎样才能禁止同一个程序同时运行  IniFile: TIniFile;
怎样才能禁止同一个程序同时运行begin
怎样才能禁止同一个程序同时运行  IniFile := TIniFile.Create(ExtractFilepath(Application.exename) + 'inifile.ini');
怎样才能禁止同一个程序同时运行
怎样才能禁止同一个程序同时运行    //读入连接字符串
怎样才能禁止同一个程序同时运行   str := IniFile.ReadString('name', 'caption', '');
怎样才能禁止同一个程序同时运行   Form1.Caption := str;
怎样才能禁止同一个程序同时运行end;
怎样才能禁止同一个程序同时运行
怎样才能禁止同一个程序同时运行procedure TForm1.CreateParams(var Param: TCreateParams);
怎样才能禁止同一个程序同时运行begin
怎样才能禁止同一个程序同时运行 inherited CreateParams(Param);
怎样才能禁止同一个程序同时运行  Param.WinClassName := MYAPPNAME;
怎样才能禁止同一个程序同时运行end;
怎样才能禁止同一个程序同时运行
怎样才能禁止同一个程序同时运行procedure TForm1.RestoreRequest(var Message: TMessage);
怎样才能禁止同一个程序同时运行begin
怎样才能禁止同一个程序同时运行 if IsIconic(Application.Handle) = True then
怎样才能禁止同一个程序同时运行    Application.Restore
怎样才能禁止同一个程序同时运行  else
怎样才能禁止同一个程序同时运行    Application.BringToFront;
怎样才能禁止同一个程序同时运行end;
怎样才能禁止同一个程序同时运行
怎样才能禁止同一个程序同时运行procedure TForm1.FormCreate(Sender: TObject);
怎样才能禁止同一个程序同时运行var
怎样才能禁止同一个程序同时运行  str: string;
怎样才能禁止同一个程序同时运行  IniFile: TIniFile;
怎样才能禁止同一个程序同时运行begin
怎样才能禁止同一个程序同时运行  IniFile := TIniFile.Create(ExtractFilepath(Application.exename) + 'inifile.ini');
怎样才能禁止同一个程序同时运行
怎样才能禁止同一个程序同时运行    //读入连接字符串
怎样才能禁止同一个程序同时运行   str := IniFile.ReadString('name', 'caption', '');
怎样才能禁止同一个程序同时运行   Form1.Caption := str;
怎样才能禁止同一个程序同时运行end;
怎样才能禁止同一个程序同时运行
怎样才能禁止同一个程序同时运行end.
怎样才能禁止同一个程序同时运行
注:代码中红色部分是实现功能的主部分,只要添加这些代码就可以了



参考出处: http://topic.csdn.net/t/20020411/10/637733.html

相关文章: