procedure Tsafe_mainForm.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = VK_F1 then begin ShellExecute(0,'open','safe.chm',nil,nil,SW_SHOW); end; end; 本身就在KEYDOWN事件里写的。
if key = chr(VK_f1)then.... 或者 Form.KeyPreView := true; 然后 if Key = VK_F1 then begin ShellExecute(0,'open','safe.chm',nil,nil,SW_SHOW); end;
Shift: TShiftState);
begin
if Key = VK_F1 then
begin
ShellExecute(0,'open','safe.chm',nil,nil,SW_SHOW);
end;
end;
本身就在KEYDOWN事件里写的。
或者
Form.KeyPreView := true;
然后
if Key = VK_F1 then begin
ShellExecute(0,'open','safe.chm',nil,nil,SW_SHOW);
end;
这样也不行呀?
在编译时提示类型不匹配。