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?
****************************************************************************
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
/*------------------------------------------------------------------------*/
MsgTimer('Informação',10)
MsgInfo('Mensagem','Informação')
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 52 guests