#include "FiveWin.ch"
#define PBS_MARQUEE 8
#define PBM_SETMARQUEE WM_USER + 10
#define GWL_STYLE -16
//----------------------------------------------------------------------------//
function MsgRun( cCaption, cTitle, bAction )
local oDlg, oMeter, oText, oBtn, oFont
local nVal := 90, Result := .T., oTmr := NIL
local nHeight
Local nAumento := 1, nLength := 0
cCaption := AllTrim(cCaption)
nLength := Len(cCaption)
While nLength > 70 // 60
nAumento++
nLength -= 70 // 60
end
nAumento += StrCharCount(cCaption,CRLF)
If nAumento > 5
nAumento--
end
nHeight := 7 + ( nAumento + 0.5)
DEFAULT bAction := { || nil },;
cCaption := "Processando...",;
cTitle := "Por favor, aguarde..."
cTitle := cTitle
DEFINE FONT oFont ;
NAME GetSysFont() ;
SIZE 0, -8
DEFINE DIALOG oDlg ;
FROM 5, 5 TO nHeight, 55 ;
TITLE cTitle ;
FONT oFont
DEFINE Timer oTmr ;
Of oWnd ;
Interval 10 ;
Action (SetWindowLong(oMeter:hWnd, GWL_STYLE, nOr( GetWindowLong(oMeter:hWnd, GWL_STYLE), PBS_MARQUEE )) ,;
oDlg:Update() )
oDlg:lHelpIcon := .F.
@ 0.2, 0.5 SAY oText;
VAR cCaption;
SIZE 190, 10+(nAumento*4);
OF oDlg
@ 0.4+(nAumento*0.45), 0.7;
PROGRESS oMeter;
POSITION nVal;
SIZE 190,10;
OF oDlg
oDlg:bStart = { || oTmr:Activate(), Pause(0.1), Result := Eval( bAction) , Pause(0.1), oDlg:End() }
ACTIVATE DIALOG oDlg ;
CENTERED ;
on init (SendMessage(oMeter:hwnd, PBM_SETMARQUEE, .T. , 100),;
oMeter:Refresh())
oTmr:Deactivate()
oTmr:End()
oTmr:= NIL
oFont:End()
return Result
//----------------------------------------------------------------------------//