showmessage不好用

解决方案 »

  1.   

    那MessageBox   MessageDlg
    Displays a specified message to the user.function MessageBox(const Text, Caption: PChar; Flags: Longint = MB_OK): Integer;DescriptionUse MessageBox to display a generic dialog box a message and one or more buttons. Caption is the caption of the dialog box and is optional.MessageBox is an encapsulation of the Windows API MessageBox function. TApplication抯 encapsulation of MessageBox automatically supplies the missing window handle parameter needed for the Windows API function.The value of the Text parameter is the message, which can be longer than 255 characters if necessary. Long messages are automatically wrapped in the message box. The value of the Caption parameter is the caption that appears in the title bar of the dialog box. Captions can be longer than 255 characters, but don't wrap. A long caption results in a wide message box.The Flags parameter specifies what buttons appear on the message box and the behavior (possible return values). The following table lists the possible values. These values can be combined to obtain the desired effect.Value MeaningMB_ABORTRETRYIGNORE The message box contains three push buttons: Abort, Retry, and Ignore.
    MB_OK The message box contains one push button: OK. This is the default.
    MB_OKCANCEL The message box contains two push buttons: OK and Cancel.
    MB_RETRYCANCEL The message box contains two push buttons: Retry and Cancel.
    MB_YESNO The message box contains two push buttons: Yes and No.
    MB_YESNOCANCEL The message box contains three push buttons: Yes, No, and Cancel.MessageBox returns 0 if there isn抰 enough memory to create the message box. Otherwise it returns one of the following values:Value Numeric value MeaningIDOK 1 The user chose the OK button.
    IDCANCEL 2 The user chose the Cancel button.
    IDABORT 3 The user chose the Abort button.
    IDRETRY 4 The user chose the Retry button.
    IDIGNORE 5 The user chose the Ignore button.
    IDYES 6 The user chose the Yes button.
    IDNO 7 The user chose the No button.
      

  2.   

    Displays a message dialog box in the center of the screen.UnitQDialogsCategorydialog and message routinesfunction MessageDlg(const Msg: WideString; DlgType: TMsgDlgType; Buttons: TMsgDlgButtons; HelpCtx: Longint; DefaultBtn: TMsgDlgBtn = mbNone; Bitmap: TBitmap = nil): Integer; overload;
    function MessageDlg(const Caption: WideString; const Msg: WideString; DlgType: TMsgDlgType; Buttons: TMsgDlgButtons; HelpCtx: Longint; DefaultBtn: TMsgDlgBtn = mbNone; Bitmap: TBitmap = nil): Integer; overload;function MessageDlg(const Caption: WideString; const Msg: WideString; DlgType: TMsgDlgType; Buttons: TMsgDlgButtons; HelpCtx: Longint; X, Y: Integer; DefaultBtn: TMsgDlgBtn = mbNone; Bitmap: TBitmap = nil): Integer; overload;function MessageDlg(const Caption: WideString; const Msg: WideString; DlgType: TMsgDlgType; Button1, Button2, Button3: TMsgDlgBtn; HelpCtx: Longint; X, Y: Integer; DefaultBtn: TMsgDlgBtn = mbNone; Bitmap: TBitmap = nil): Integer; overload;DescriptionCall MessageDlg to bring up a message box and obtain the user's response. Caption specifies the caption for the message box when DlgType is mtCustom. If this parameter is not used (the first syntax), the caption for custom message boxes is the title of the application.Msg is the content of the message that appears.DlgType indicates the purpose of the dialog.Buttons indicates what buttons should appear in the message box. Note that if you want to use a three button message box, you can use the last syntax instead, and control the order in which the buttons appear.Button1, Button2, and Button3 indicate what types of buttons to use for a three button message box. The resulting buttons appear in order.HelpCtx specifies the context ID for the help topic that should appear when the user clicks the help button or presses F1 while the dialog is displayed.X and Y specify the screen coordinates where the dialog should appear. A value of ? means that the message box can appear anywhere in the specified dimension.DefaultBtn specifies which button from among those specified by Buttons (or Button1, Button2, and Button3) is the default button for the dialog. If DefaultBtn is mbNone, there is no default button.Bitmap is an image that appears on the face of the message dialog. If Bitmap is nil, there is no image unless DlgType is mtConfirmation.MessageDlg returns the value of the button the user selected. The following table lists the TMsgDlgBtn values for each type of button that can appear in the message box, and the corresponding value that is returned if the user selects that button:TMsgDlgBtn Value Corresponding return valuembOk mrOk
    mbCancel mrCancel
    mbYes mrYes
    mbNo mrNo
    mbAbort mrAbort
    mbRetry mrRetry
    mbIgnore mrIgnore
    这两个应该不错了吧,,再不行,,自己写一个窗体,,来代替
      

  3.   

    看看这个例子
      with Application do
      begin
        //...
        MessageBox('This should be on top.', 'Look', MB_OK);
      end;