delphi7做的程序, 在操作系统任务栏的程序图标上右键弹出菜单里选择“关闭”时,是触发什么事件?该如何解决

delphi7做的程序, 在操作系统任务栏的程序图标上右键弹出菜单里选择“关闭”时,是触发什么事件???
我想做成这样的效果:在操作系统任务栏的程序图标上右键弹出菜单里选择“关闭”后,先弹出确认对话框,选择“是”:退出程序;选择“否”返回程序窗口。
请写出相关代码并说明!

------解决方案--------------------
//会触发FormCloseQuery事件

procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
if application.MessageBox('是否保存?','询问',mb_okcancel+mb_iconquestion)=idok then
CanClose := true
else
CanClose := false;
end;

------解决方案--------------------
在主窗口的OnCloseQuery事件中
[code=Delphi(Pascal)][/code]
procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
if Application.MessageBox('确实要退出系统吗?','询问',MB_YESNO + MB_ICONQUESTION)<>IDYES then
begin
CanClose := False;
end
else
begin
CanClose := True;
end;
end;
------解决方案--------------------
Delphi(Pascal) code
procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
  if Application.MessageBox('确实要退出系统吗?','询问',MB_YESNO + MB_ICONQUESTION)<>IDYES then
  begin
  CanClose := False;
  end
  else
  begin
  CanClose := True;
  end;
end;