Here's a little time display program that I find useful .. :)
You can left click on it to drag it to another position
'
' EBasic Time Display ..
' GWS - December 2006
'
AutoDefine "Off"
Window w
Const WM_NCLBUTTONDOWN = 0xA1
Const HTCAPTION = 2
If (Init() = 1) Then WaitUntil w = 0
End
Sub main
Select @message
Case @IDControl
If (@ControlID = 1)
StopTimer w,1
CloseWindow w
EndIf
Case @IDLButtonDN
' Move the Window by dragging it ..
SendMessage w.hwnd,WM_NCLBUTTONDOWN,HTCAPTION,0
ÂÃ, EndSelect
Return
EndSub
Sub Init(),Int
ÂÃ, Int scrW,scrH
ÂÃ, GetScreenSize scrW, scrHÂÃ,Â
ÂÃ, OpenWindow (w,(scrW-60)/2,0,60,18,@NoCaption|@ToolWindow|@TopMost,0,"",&main)
ÂÃ, If (w = 0) Then Return 0
ÂÃ, Control w,@Button,"",50,0,10,18,0,1
ÂÃ, SetWindowColor w, 0x555555
ÂÃ, FrontPen w, 0xffff00
ÂÃ, BackPen w, 0x555555
ÂÃ, SetFont w, "Times New Roman",8,400
ÂÃ, StartTimer w,10000,1,×et
ÂÃ, timeset(w.hwnd,@idtimer,1,0)
Return 1
EndSub
Sub timeset(hwnd:UInt,msg:UInt,idEvent:UInt,dwTime:UInt)
' set time in HH.MM format and display it ..
ÂÃ, Move w,12,2
ÂÃ, Print w,Left$(Time$,5)
Return
EndSub
all the best, :)
Graham
Hey Graham!
Is there a way to show 12 hours instead of 24 hours? The user guide does not say that much, only:
TIME$
STRING = TIME$
Description Returns the current time.
Parameters None.
Return value String containing the current time in the format HH:MM:SS
Remarks See Also: DATE$
Example usage PRINT TIME$
split and store the time$ string in 2 variables
1st is the hours and 2nd is the rest
Then test val of 1st to see if it's 12 or more
if so subtract 12 and set a flag to indicate pm (0=am/1=pm)
print resulting 1st variable and original 2nd variable with USING$
Ah .. Larry beat me to it .. :)
It's a nice little exercise in string handling and the use of Val() and Str$() functions.
all the best, :)
Graham