Code: Select all
#include "fivewin.ch"
#define AW_VER_NEGATIVE 0x00000008 // animate window
#define AW_SLIDE 0x00040000 // animate window
static owndidc, ownd, omsgbar
function main()
oWndIdc := NIL
DEFINE WINDOW oWnd TITLE "Message Test - Press F3" ;
FROM 5, 5 TO 24, 64
DEFINE MSGBAR OMSGBAR OF OWND NOINSET
oWnd:bKeyDown := {|nKey| IF(nKey==VK_F3,FwhMsgIDC( 'Message test'),)}
ACTIVATE WINDOW oWnd maximized
return nil
/***************************************************************************************************/
procedure FwhMsgIDC( cMsg )
local oSay, oFontIDC, nPos, nCol, otimer
local nPosAux := 250
local nColAux := 245
Default cMsg := ''
if oWndIdc != nil
oWndIdc:End()
oWndIdc := nil
syswait(0.2)
endif
nPos := ownd:omsgbar:nWidth-nPosAux
nCol := ownd:omsgbar:ntop-nColAux
define font ofontidc name "Lucida Console" size -8,16 bold
define window owndidc title "Message" from nCol, nPos to ( nCol+nColAux ), ( nPos+nPosAux ) pixel nominimize nomaximize color CLR_BLACK, RGB(126,192,238) of oWnd
@ 00,-10 say osay var cMsg of owndidc center font ofontidc size 250,245 pixel
AnimateWindow( owndidc:hwnd,400, nor( AW_SLIDE, AW_VER_NEGATIVE ) )
SetWindowPos( owndidc:hwnd, -1, 0, 0, 0, 0, 3 )
activate window owndidc on init( oTimer := FlashWndTimer( owndidc ),;
owndidc:Refresh(), SysRefresh() );
valid( owndidc := nil,;
hb_gcall( .t. ),;
ofontidc:End(),;
oTimer:DeActivate(),;
.t. ) ;
on resize( oWndIdc:move(nCol,nPos),;
oWndidc:nWidth := nPosAux,;
oWndidc:nHeight := nColAux,;
oWndIdc:Refresh(),;
SysRefresh() )
return
/********************************************************/
FUNCTION FlashWndTimer( ohWnd, nDelay, bWhen )
local oTimer
DEFAULT nDelay := 2000
DEFAULT bWhen := { || .T. }
DEFINE TIMER oTimer INTERVAL nDelay ACTION (Flashing( ohWnd, bWhen ))
ACTIVATE TIMER oTimer
RETURN oTimer
/********************************************************/
STATIC FUNCTION Flashing( ohWnd, bWhen )
static nStatus := 1
local hWnd
hWnd := iif( ValType(ohWnd) != "O", ohWnd, ohWnd:hWnd )
if Eval( bWhen, hWnd )
FlashWnd( hWnd, (nStatus := iif( nStatus == 1, 0, 1 )) )
endif
RETURN .T.
DLL32 STATIC FUNCTION FlashWnd( hWnd AS LONG, nInvert AS LONG ) AS LONG PASCAL FROM "FlashWindow" LIB "User32.dll"
DLL32 FUNCTION AnimateWindow( hWnd AS LONG, nTime AS LONG, nFlags AS LONG ) AS BOOL PASCAL LIB "user32.dll"