我想在MessageBox弹出时将一个变量值显示出来,可是系统老提示出错。
我的代码差不多是这样的。
var
i:integer;
begin
 i:=12;
 application.messagebox('i的值为:'+inttostr(i),'提示',MB_OK+MBICONINFORMATION);
end;可是提示说“string and PAnsiChar”,不能编译通过,这是为什么呢???

解决方案 »

  1.   

    application.messagebox('i的值为:'+pChar(inttostr(i)),'提示',MB_OK+MBICONINFORMATION);
      

  2.   

    messagebox中加入自定义字符串的方法 
    Application.MessageBox(PChar('你要'+Edit1.text,'),信息提示',MB_OK+MB_ICONINFORMATION)
      

  3.   

    application.messagebox(pChar('i的值为:'+inttostr(i)),'提示',MB_OK+MBICONINFORMATION);
      

  4.   

    application.messagebox('i的值为:'+pChar(inttostr(i)),'提示',MB_OK+MBICONINFORMATION);
      

  5.   

    application.messagebox(PCHAR('i的值为:'+inttostr(i)),'提示',MB_OK+MBICONINFORMATION);
      

  6.   

    你下次在写程序时在输入的时候注意一下括号里边的提示信息,它们的类型不一样的~~
    messagebox中加入自定义字符串的方法 
    Application.MessageBox(PChar('i的值为:'+inttostr(i)),‘信息提示',MB_OK+MB_ICONINFORMATION)
      

  7.   

    PCHAR('i的值为:'+inttostr(i) 这种方式是对的
      

  8.   

    此方法的原型是:
    function TApplication.MessageBox(const Text, Caption: PChar; Flags: Longint): Integer;所以最好这样写:application.messagebox(pchar('i的值为:'+inttostr(i)),pchar('提示'),MB_OK+MBICONINFORMATION);
      

  9.   

    application.messagebox(pChar('i的值为:'+inttostr(i)),'提示',MB_OK+MBICONINFORMATION);
      

  10.   

    对类型不一样
    Application.MessageBox(PChar('i的值为:'+inttostr(i)),‘信息提示',MB_OK+MB_ICONINFORMATION)
      

  11.   

    application.messagebox(self.handle,'i的值为:'+inttostr(i),'提示',MB_OK+MBICONINFORMATION);