procedure Tmaiform2.WMHotKey(var Msg: TWMHotKey);
begin
if Msg.HotKey = HotKeyId[0] then
begin
maiform2.Button1Click(button1);
maiform3.Button1Click(button1);
maiform4.Button1Click(button1);
maiform5.Button1Click(button1);
end;
我定义了一个热键,然后按下以后启动自身的按钮里的代码和调用其他窗体里的按钮。但是调用不了。求解决。
begin
if Msg.HotKey = HotKeyId[0] then
begin
maiform2.Button1Click(button1);
maiform3.Button1Click(button1);
maiform4.Button1Click(button1);
maiform5.Button1Click(button1);
end;
我定义了一个热键,然后按下以后启动自身的按钮里的代码和调用其他窗体里的按钮。但是调用不了。求解决。
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
procedure WMHotKey(var Msg: TWMHotKey); message WM_HOTKEY;
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}{ TForm1 }procedure TForm1.WMHotKey(var Msg: TWMHotKey);
begin
if Msg.HotKey = $33 then
begin
ShowMessage('Ctrl+F6');
end;
end;procedure TForm1.FormCreate(Sender: TObject);
begin
RegisterHotKey(Handle,$33,MOD_CONTROL,VK_F6);
end;end.运行后按Ctrl+F6触发.