by byron.hopp » Tue May 23, 2006 12:29 am
Antonio,
I just pulled this out of the much larger program. You can at least see how we are doing it. If there is a better way, please let us know.
Thanks,
Byron...
Source Below
FUNCTION SAVEYESADVERTISE(lENABLE)
LOCAL oINI
LOCAL cINIFILE:=MCS_ININAME()
LOCAL cENABLE:=IIF(lENABLE,"YES","NO")
//
INI oIni FILE cIniFile
SET SECTION "Advertisements" ENTRY "EnableAdvertise" TO cENABLE OF oINI
ENDINI
RETURN NIL
FUNCTION GETYESADVERTISE()
LOCAL cINIFILE:=MCS_ININAME()
LOCAL oINI
LOCAL cRV
LOCAL lRV:=.F.
INI oIni FILE cIniFile
GET cRV SECTION "Advertisements" ENTRY "EnableAdvertise" DEFAULT "NO" OF oIni
ENDINI
lRV:=IIF(cRV=="YES",.T.,.F.)
RETURN lRV
FUNCTION CHKADVERTISE()
IF lADVERTISE
SCROLLNOW()
ENDIF
RETURN NIL
FUNCTION SCROLLMESSAGE(cMESSAGE)
LOCAL hDC
LOCAL nOldFont
LOCAL hPen
LOCAL hOldPen
IF lADVERTISE
* hDC:=oSCROLLBMP:hDC
* SetBkMode(hDC, TRANSPARENT)
* TextOut(hDC, 5, 100,cMESSAGE)
nSCROLLCOL+=5
IF nSCROLLCOL > 1300
nSCROLLCOL:=-500
ENDIF
hDC := oSCROLLBMP:hDC
nOldFont := SelectObject(hDC,oSCROLLFont:hFont)
hPen := CreatePen(0,0,CLR_RED)
hOldPen := SelectObject(hDC,hPen)
SETTEXTCOLOR(hDC,CLR_RED)
SetBkMode(hDC, TRANSPARENT )
TextOut(hDC,8,nSCROLLCOL,cMESSAGE,Len(cMESSAGE))
//
SelectObject(hDC,nOldFont)
SelectObject(hDC,hOldPen)
DeleteObject(hPen)
ENDIF
RETURN NIL
FUNCTION SCROLLNOW()
IF lADVERTISE
// oSCROLLBMP:REFRESH(.F.)
IF oSCROLLSAY <> NIL
nSCROLLCOL-=4
IF nSCROLLCOL < nSTARTCOL
nSCROLLCOL:=1280
ENDIF
oSCROLLSAY:Move(980,nSCROLLCOL,1280,50,.F.)
oSCROLLSAY:REFRESH(.F.)
ENDIF
ENDIF
RETURN NIL
FUNCTION SCROLLTIMER()
nSCROLLCTR:=0
DEFINE TIMER oSCROLLTIMER OF oWND ;
INTERVAL 60 ;
ACTION (nSCROLLCTR++,CHKADVERTISE())
ACTIVATE TIMER oSCROLLTIMER
RETURN NIL
FUNCTION GETSTARTCOL(cMESSAGE)
LOCAL nRV :=0
nRV :=GETTEXTWIDTH(0,cMESSAGE,oSCROLLFONT:hFONT)
RETURN nRV
Thanks,
Byron Hopp
Matrix Computer Services