MsgInfo() with Timer

Post Reply
User avatar
Anderson.OL
Posts: 92
Joined: Thu Feb 15, 2007 11:37 am
Location: Itaocara - RJ - Brasil
Contact:

MsgInfo() with Timer

Post by Anderson.OL »

Good morning everyone ..

Has anyone modified the function MsgInfo () so that if the user is not near the pc, after 5 seconds it closes and the system continues its processing?
FiveWin 9.03 + xHarbour !!
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Re: MsgInfo() with Timer

Post by ukoenig »

Hello,
I think instead of using Msginfo :

MsgWait( "Please, just wait a little!", "This is a test", 15 ) // 15 Seconds

MsgInfo() is used, to force a user, to take notice of something happend.

Best Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
Anderson.OL
Posts: 92
Joined: Thu Feb 15, 2007 11:37 am
Location: Itaocara - RJ - Brasil
Contact:

Re: MsgInfo() with Timer

Post by Anderson.OL »

I created the following functions

Code: Select all

****************************************************************************
static procedure MsgTimer(cMessageCaption, nSeconds)
****************************************************************************
*
* Fechar um MsgDialog automaticamente
* Parametros: cMessageCaption, nSegundos
* Retorno: Nenhum
*
* Autor: Anderson
* 1/2/2011 - 12:03:46
*
****************************************************************************

public oTmr := NIL

   Define Timer    oTmr             ;
          Interval 1000             ;
          ;//Action   (if (nHandle > 0 , nTempo++  , /* nada faz */ ),;
          ;//          DoIncTimer() )  ;
          Action   DoIncTimer(cMessageCaption, nSeconds);
          of       oWnd
          
   oTmr:Activate()

Return Nil

/*------------------------------------------------------------------------*/

****************************************************************************
static procedure DoIncTimer(cMessageCaption, nSeconds)
****************************************************************************
*
* Tarefa a ser executada antes de estourar o timer
* Parametros: cMessageCaption, nSeconds
* Retorno: Nenhum
*
* Autor: Anderson
* 1/2/2011 - 12:17:07
*
****************************************************************************

static nHandle := -1
static nTempo  := 0

   if nHandle <= 0
      nHandle := FindWindow(nil, cMessageCaption)
      SetWindowText(nHandle,cMessageCaption + ' (' + StrTrim(nSeconds - nTempo) + ')')
   end

   if nHandle > 0
   
      //-- Começa a contar a partir do momento que acha a janela ---------//
      
      nTempo++
      
      if nTempo == nSeconds
      
         //-- Se estorou o tempo fecha a janela e destroi o timer --------//
         SendMessage(nHandle, WM_CLOSE)
         oTmr:Deactivate()
         oTmr:End()
         Release oTmr
         
      else
      
         //-- Exibe a contagem do tempo ----------------------------------//
         
         SetWindowText(nHandle,cMessageCaption + ' (' + StrTrim(nSeconds - nTempo) + ')')
         
      end
      
   end

Return Nil

/*------------------------------------------------------------------------*/
And I use this way.

Code: Select all

MsgTimer('Informação',10)
MsgInfo('Mensagem','Informação')
FiveWin 9.03 + xHarbour !!
Post Reply