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

📄 unit2.pas

📁 实现窗口的隐藏 标题的改变 图标的替换
💻 PAS
字号:
unit Unit2;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls ,ShellApi, Mask, ToolEdit, ExtCtrls;

type
  TForm2 = class(TForm)
    Edit1: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    Button1: TButton;
    Button2: TButton;
    Edit2: TFilenameEdit;
    Edit3: TEdit;
    procedure Button1Click(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

uses Unit1;

{$R *.dfm}

procedure TForm2.Button1Click(Sender: TObject);
var
  fil : Tfilestream;
  IconIndex : word;
  fname:String;
  ico : Ticon;
begin
  fname:=StringReplace(Edit2.text,'"','',[rfReplaceAll]);
  if Edit1.Text<>'' then SetWindowText(Form1.myhand,pchar(Edit1.Text));
  if fname<>'' then
  try
    IconIndex:=StrToInt(Edit3.Text);
    ico := Ticon.create;
    if not fileexists(fname) then
    fil := Tfilestream.create(fname,fmcreate);  //文件名
    ico.handle := ExtractAssociatedIcon(hInstance,pchar(fname), IconIndex);
    SendMessage(Form1.myhand,WM_SETICON,ICON_SMALL,ico.handle);
  finally
    ico.free;
    if fil <> nil then fil.free;
  end;
end;

procedure TForm2.FormShow(Sender: TObject);
begin
Edit1.Text:=Form1.mycaption;
Edit2.Text:='C:\Program Files\Internet Explorer\IEXPLORE.EXE';
end;

procedure TForm2.Button2Click(Sender: TObject);
begin
Close;
end;

end.

⌨️ 快捷键说明

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