⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unit1.pas

📁 Delphi实效编程百例的随书源代码 这是其中的程序控制部分
💻 PAS
字号:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

const
  CM_RESTORE = WM_USER + $1000;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    procedure CreateParams(var Params: TCreateParams); override;
    Procedure RestoreRequest(var message: TMessage); message CM_RESTORE;
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.CreateParams(var Params: TCreateParams);
//初始化参数
begin
  inherited CreateParams(Params);
  Params.WinClassName := '我的Delphi程序';
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);
//得到程序的句柄
begin
  Label2.Caption := inttohex(Application.Handle, 8);
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -