SysClockFrm Form1% Timer1 Label1 MhTimer1_ClickV Timer1_Timer: TimeLbl Caption DateLBL= Form1 Form_Click Form_Load Form_DblClick ControlBox Label1_Click Label1_DblClick SysClockFrm GetModuleHandlev ModNameb GetHeapSpacesz hModule OldTotal GetFreeResources ModuleName rInfo Totalr HiWord FreeRT LoWord LongInt Temp2 TFree texth CurrentX CurrentYp RText Timer1 Timer GetActiveWindow GetWindowTextLength hWndN SetWindowText lpstr IsIconic GetParent IsWindow WindowVisible[ IsWindowVisible GetWindowText OldText NewTextk Handle ParentL TempVara OldHandleV FixTitleB WinHand ShowTime WinHnd" TemVar FixTileb ModHnd ShowWindow nCmdShow SW_ShowNormal} WinShow WinFlash FlashWindowf bInvert6 Heightg Form_Paint BorderFrame Screen@ ActiveFormT Width Frame Label1 Label1_MouseDownI Button Shift PixStartX TPRatio PixStartY PixOffsetX PixOffsetY OkToMove' GhostFormPixStartX= GhostForm Label1_MouseMove PixX. Label1_MouseUp FormM UnrealizeObjectw hObject SelectObject GetStockObject nIndexZ Rectangle SetROP2 nDrawMode CreateRectRgn SelectClipRgn hRgn, DeleteObjectf GetDC ReleaseDCm DeleteDC7 RestoreDC nSavedDC hScreen/ hRegionK RgnX1 RgnY1] RgnX2 RgnY2 hBrush NULL_BRUSH hObjOld PixStart Scalemodec PixelWidth ScaleWidth R2_NOTXORPEN; hRegion2h hScreen2 SetWindowPosl hWndInsertAfteru wFlags AsInteger ByValwFlagsr SetStayOnTop Valueg OnTop Norml SettingFrm SettingsFrmM GetPrivateProfileString lpApplicationName lpKeyName lpDefault$ lpReturnedStringw nSize0 lpFileName? WritePrivateProfileString lpString: lplFileName AddResFlag ResStr TitleBarFlag Setting OnTopFlag HideFlag ReadPrivateProfileString RetBuf SetFrmSize Form_GotFocus Position SepB xDPIN GetDeviceCaps AllTheTime[ LOGPIXELSXr GTwpsPerPxlX HORZRES FontSize Backcolor ForeColor DelayJ Declare API functions for getting & setting windows titles Declare API functions for dragging a rectangle of the form DPxn Declare form variables Fixed for passing to API Variables for dragging form subs Twips to Pixel ratio FixTitle NOTICE The FixTitle Routine is copyrighted by Paul Bonner and Ziff-Davis, 1993 This sub adds the time to the title bar of the active visible window and takes two parameters: the windows handle and an integer flag that indicates whether the time should be removed or added shown Declare variablesi Start with a DoEvents to let other apps proceeda If a parent exists and is visible then use it's handle Get Caption of active window or if there is none then exit sub exits if no captions Strip off null character (Chr$(0)) from fixed string passed by API Set the new caption to the old caption and test for "<<" in the caption> Trim the new caption string If flag is true then add the time to the caption hh:mm am/pm Make sure the windows handle is still valid, the window is visible and the new caption H isn't the same as the old caption Form_Load Fixed string for return buffer from .ini file Get previous form position from .ini file Settings Position SysClock.ini If previous position is returned use it to position the form Set form position if there is a saved position If no previous position then position the form at bottom right of screen Calculate the TwipstoPixel ratio Set to pixelst gives width in pixelst Switch back to twips Get settings from SysClock.ini Setting% = GetPrivateProfileString("Settings", "Title Bar", "False", RetBuf, 10, "SysClock.ini") If RetBuf = "False" Then TitleBarFlag = Falsen TitleBarFlag = True End If Settings Add Res SysClock.ini False Settings On Top SysClock.ini False Set form to stay on top if OnTopFlag is True Fill label immediately by calling timer eventn Set length of clock depending on length of time label Form_Paint Draw 3D frame around formu GhostForm ) NOTICE The GhostForm Routine is copyrighted by Keith Pleas and Fawcette Technical Publications, 1993 This sub provides the ghostform for dragging Label1_DblClick Brings up configuration settings dialog boxi Label1_MouseDown This sub provides dragging capability for the clock form Label1_MouseMove This sub is for dragging the form Label1_MouseUp This sub is for dragging the form Timer1_Timer If AddRes is true then add resources to displays Determine the percent of free resources using functions in sysclock.bas Put resources in a stringf If resources are below 25% then change the color of the clock to red to warn user SysClockFrm.BackColor = &HFF&H SysClockFrm.BackColor = &HC0C0C0 Put the info in label caption ddd m/d/yy hh:mm AM/PM Adding time to title bar feature was removed but code left in forc possible use in the future 3/93 Add time to title bar of active window if TitleBarFlag is true Get the window handle of the active window Exit if active window is the sysclock form If the window handle changes then call Fixtitle to first remove thee old title (this is necessary before resetting the new time)