退出提示已解决,修改提示又有问题了,如何解决呢? VCL组件开发及应用http://www.delphi2007.net/DelphiVCL/html/delphi_20061225122335129.html
procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
CanClose := MessageBox(Handle, '你真的要退出吗?', '警告',
MB_OKCANCEL + MB_ICONWARNING) = IDOK;
end;
退出提示是正确的,但用到了修改就有了问题
procedure TForm1.Button4Click(Sender: TObject);
var
canedit:Boolean;
begin
if
Canedit = MessageBox(Handle, '你真的要退出吗?', '警告',
MB_OKCANCEL + MB_ICONWARNING) = IDOK then
begin
ADOQuery1.Edit;
ADOQuery1.Fields[1].AsString:=edit2.Text;
ADOQuery1.Fields[2].AsString:=edit3.Text;
ADOQuery1.Fields[3].AsString:=edit4.Text;
ADOQuery1.Fields[4].AsString:=ComboBox1.Text;
ADOQuery1.Fields[5].AsString:=RichEdit1.Text;
ADOQuery1.Post;
end
else
end;
错误提示:incompatible types(if后的条件语句出错)
if
Canedit = MessageBox(Handle, '你真的要退出吗?', '警告',
MB_OKCANCEL + MB_ICONWARNING) = IDOK then
?????????
改成:
if
Canedit = (MessageBox(Handle, '你真的要退出吗?', '警告',
MB_OKCANCEL + MB_ICONWARNING) = IDOK) then
最好是:
if
MessageBox(Handle, '你真的要退出吗?', '警告',
MB_OKCANCEL + MB_ICONWARNING) = IDOK then
笔误,修改如下:
if
Canedit = (MessageBox(Handle, '你真的要退出吗?', '警告',
MB_OKCANCEL + MB_ICONWARNING) = IDOK) then
--------------------------------
if
True = (MessageBox(Handle, '你真的要退出吗?', '警告',
MB_OKCANCEL + MB_ICONWARNING) = IDOK) then