Se não me engano, essa function foi desenvolvida pelo Rubem, copie e cole:
function MessageBoxTimer(const AMsg, ATitle: String; DlgType: TMsgDlgType; Buttons: TMsgDlgButtons; MSecs: Cardinal = 0; ShowProgressBar: Boolean = True) : integer; var lMsgDialog: TForm; lTimerMethod: TNotifyEvent; procedure UpdateProgressBar(Data: Pointer; Sender: TObject); var lForm: TForm; lProgressBar: TProgressBar; begin if Sender is TTimer then if TTimer(Sender).Owner is TForm then begin lForm := TForm(TTimer(Sender).Owner); lProgressBar := TProgressBar(lForm.FindComponent('ProgressBar')); if Assigned(lProgressBar) then if lProgressBar.Position + 1 < lProgressBar.Max then lProgressBar.StepIt else lForm.ModalResult := mrCancel; end; end; procedure TranslateCaptionButtons; const AButtonNames: array[TMsgDlgBtn] of String = ('YES', 'NO', 'OK', 'CANCEL', 'ABORT', 'RETRY', 'IGNORE', 'ALL', 'NOTOALL', 'YESTOALL', 'HELP'); AButtonCaptions: array[TMsgDlgBtn] of String = ('Sim', 'Não', 'Ok', 'Cancelar', 'Abortar', 'Retentar', 'Ignorar', 'Tudo', 'Não a Tudo', 'Sim a Tudo', 'Ajuda'); var lBtnType: TMsgDlgBtn; lButton: TButton; begin for lBtnType := Low(TMsgDlgBtn) to High(TMsgDlgBtn) do begin lButton := TButton(lMsgDialog.FindComponent(AButtonNames[lBtnType])); if Assigned(lButton) then lButton.Caption := AButtonCaptions[lBtnType]; end; end; begin // Cria a caixa de diálogo lMsgDialog := CreateMessageDialog(AMsg, DlgType, Buttons); lMsgDialog.Caption := ATitle; // Traduz botões existentes no diálogo TranslateCaptionButtons; // Checa se será necessário uma barra de progresso if MSecs > 0 then begin with TProgressBar.Create(lMsgDialog) do begin Name := 'ProgressBar'; Parent := lMsgDialog; Align := alBottom; Max := MSecs div 1000; Min := 0; Step := 1; Position := 0; Visible := ShowProgressBar; end; lMsgDialog.Height := lMsgDialog.Height + (Ord(ShowProgressBar) * 10); with TTimer.Create(lMsgDialog) do begin Name := 'MsgTimer'; Interval := 1000; end; // Cria o timer, usando uma rotina 'solta' (stand-alone, desvinculada de // uma instância de objeto) para fazer o trabalho de atualização da barra // de progressão (caso exista) e também o tempo que será contado para // fechar a janela TMethod(lTimerMethod).Code := Addr(UpdateProgressBar); TMethod(lTimerMethod).Data := lMsgDialog.FindComponent('MsgTimer'); TTimer(lMsgDialog.FindComponent('MsgTimer')).OnTimer := lTimerMethod; try // Chama a caixa de diálogo e verifica o seu retorno Result := lMsgDialog.ShowModal; finally lMsgDialog.Free; end; end; end; blz brunolbra...@yahoo.com.br escreveu: > > > Boa tarde! > > Seguinte... se eu dou o comando: > > showMessage('Teste'); > > o delphi exibe uma caixa com a msg: Teste na tela e essa msg só sai depois > que alguém pressionar em OK. > > Tem como eu fazer algum comando para essa msg sair automaticamente? > > Obrigado! > > . > >