[Delphi] 纯文本查看 复制代码 unit 读取写入ini_3;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs,
Vcl.StdCtrls;
type
TForm3 = class(TForm)
GroupBox1: TGroupBox;
Label6: TLabel;
Edit1: TEdit;
Label1: TLabel;
Edit2: TEdit;
Label2: TLabel;
Edit3: TEdit;
Label3: TLabel;
Edit4: TEdit;
Label4: TLabel;
Edit5: TEdit;
procedure hotykey(var msg: TMessage); message WM_HOTKEY;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form3: TForm3;
idF1: Integer;
implementation
{$R *.dfm}
procedure TForm3.FormDestroy(Sender: TObject);
begin
UnRegisterHotKey(handle, idF1);
end;
procedure TForm3.hotykey(var msg: TMessage);
var
F: string;
begin
if (GetAsyncKeyState(VK_CONTROL) < 0) and (GetAsyncKeyState(VK_SHIFT) < 0) and (GetAsyncKeyState(VK_F1) < 0) then
begin
// ShowMessage('Ctrl+Shift+F1');
F := ActiveControl.Name;
ShowMessage(F);
Edit3.Text := F + '_' + Edit3.Text; ================================》就这里,不设热键也没事发生啊~~ 想不通呢?
end;
end;
procedure TForm3.FormCreate(Sender: TObject);
begin
idF1 := GlobalAddAtom('hotkeyF1');
RegisterHotKey(handle, idF1, MOD_CONTROL + MOD_SHIFT, VK_F1);
end;
end.
|