鼠标右击点关闭时出错?
我在程序里面已设置了不能使用ALT+F4组合键失效,只能通过关闭按钮关闭程序
因为如果不设置成失效,用这个组合键关闭时,也会报错如下:
工程检测到错误类EAccessViolation,。。。
失效代码如下:
procedure TForm10.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if (Key=VK_F4) and (ssAlt in shift) then// 使窗体的 Alt+F4 快捷键(关闭窗体)失效
Key :=0;
end;
这样可以使得用户在使用时不能通过ALT+F4组合键来关闭窗体,可是如果在任务栏右击运行的程序,然后点“关闭”时就出错了,弹出很多的窗口,内容如下:
标题为:工程名称
Access violation at address D6C2C4CB.Read of address D6C2C4CB.
我想使用鼠标右击关闭可以关闭,但不能使用ALT+F4组合键关闭,这样可以做到吗?请高手指点,谢谢!
[解决办法]
frmMain.Comm1.StopComm; frmMain.Comm1.Free; frmMain.Timer1.Free; frmMain.Timer2.Free; frmMain.Timer3.Free; frmMain.Timer4.Free; frmMain.Timer5.Free; frmMain.WindowsMediaPlayer1.close; frmMain.WindowsMediaPlayer1.Free;