我用messagebox函数,有时候会出现这样的错误invalid floating point openation我的messagebox是用函数的方法写的,我看了传值是对的,而且有时候是能运行的,我换成 application.messagebox也不行。(环境是这样的,在控制打印的时候询问是否要打印,)
procedure TForm1.Button2Click(Sender: TObject); begin if Application.MessageBox('MessageBox', 'Title', MB_YESNO or MB_ICONQUESTION) = IDYES then ShowMessage('YES') else ShowMessage('NO'); end;
Application.MessageBox('MessageBox', 'Title', MB_YESNO or MB_ICONQUESTION)
先用这个试一试,以确定是你的系统问题,还是代码问题: procedure TForm1.Button2Click(Sender: TObject); begin if Application.MessageBox('MessageBox', 'Title', MB_YESNO or MB_ICONQUESTION) = IDYES then ShowMessage('YES') else ShowMessage('NO'); end;
str1:='Are you student?'; str2:='Information'; messagebox(handle,pchar(str1),pchar(str), MB_OKCANCEL+MB_ICONINFORMATION+MB_DEFBUTTON2);
begin
if Application.MessageBox('MessageBox', 'Title', MB_YESNO or MB_ICONQUESTION) = IDYES then
ShowMessage('YES')
else
ShowMessage('NO');
end;
你的Code有问题的
invalid floating point openation
错误!
mm:='你输入的数据不合法!';
nn:='提示';
楼主是不是使用了字符串,或资源字符串.
Application.messagebox(mm,nn,MB_YESNO);
改为:
Application.messagebox(Pchar(mm),Pchar(nn),MB_YESNO);
就可以了,不知道我说的对不对!!!!!!
procedure TForm1.Button2Click(Sender: TObject);
begin
if Application.MessageBox('MessageBox', 'Title', MB_YESNO or MB_ICONQUESTION) = IDYES then
ShowMessage('YES')
else
ShowMessage('NO');
end;
str2:='Information';
messagebox(handle,pchar(str1),pchar(str),
MB_OKCANCEL+MB_ICONINFORMATION+MB_DEFBUTTON2);