我想把edit里面的内容写到messagebox函数里,应该怎样写?

解决方案 »

  1.   

    Function MSG(Handle:THandle;sMsg:string;sType:string):Boolean;
    var sTemp:string;
        iType:integer;
    begin
    //  MB_ICONWARNING     =W
    //  MB_ICONQUESTION    =Q
    //  MB_ICONERROR       =E
    //  MB_ICONINFORMATION =I   information  if UpperCase(sType)='W' then  iType:=0;
      if UpperCase(sType)='Q' then  iType:=1;
      if UpperCase(sType)='E' then  iType:=0;
      if UpperCase(sType)='I' then  iType:=0;
      if iType=0  then
      begin
         if UpperCase(sType)='W' then
            MessageBox(Handle,Pchar(sMsg),'警告信息',MB_ICONWARNING+MB_OK)
         else
          if UpperCase(sType)='E' then
            MessageBox(Handle,Pchar(sMsg),'错误信息',MB_ICONERROR+MB_OK)
          else
            MessageBox(Handle,Pchar(sMsg),'提示信息',MB_ICONINFORMATION+MB_OK);
         Result:=True;
      end
      else
      begin
       if  MessageBox(Handle,Pchar(sMsg),'提示信息',
               MB_ICONQUESTION+MB_YesNo) = Id_Yes then Result:=True
       else
        Result:=False;
      end;
    end;这是我写的一个关于提示信息的function 你可以试一下,如果好用的话那就用吧。
      

  2.   

    可以这样用呀。MSG(handle,'aaaa','W');
    其中的'aaaa' 也可以是一个变量或是你的EDIT.TEXT 不就可以了吗?
      

  3.   

    你是要在messagebox对话框的内容显示Edit的内容吗?
    你可以用类型转化把Edit1.text转化为pchar类型的!
    有问题请发信息到我的E-mail:[email protected]
      

  4.   

    procedure TForm1.Button1Click(Sender: TObject);
    begin
      showMessage(edit1.Text);
      application.MessageBox(pchar(edit1.Text),'caption',mb_ok or mb_iconinformation);end;
      

  5.   

    application.messagebox(pchar(Edit1.Text),'a',mb_yesno)
    我试过了!可以!!!
    有问题请发信息到我的E-mail:[email protected]
      

  6.   

    procedure TForm1.Button1Click(Sender: TObject);
    begin
    application.MessageBox(pchar(edit1.Text),'caption',mb_ok or mb_iconinformation);
    end;//PChar()是关键