New and improved SICK project
#7
That looks like nice code, but,

when patched into the following snippet it produces an error:

  Statement cannot be placed between SUBS/FUNCTIONS

even if I move the include statement below main (above sub CPUtrap), then
when I start it the program window pauses for 2 seconds and vanishes.

Code: (Select All)
' declare all default variables
DefDbl A-Z
Rem $DYNAMIC
Rem $Include:'mem.bi'
Dim Shared t6 As Integer
Dim Shared t7 As Single

' start cpu timer trap
t6 = _FreeTimer
t7! = 1!
On Timer(t6, t7!) CPUtrap
Timer(t6) On
Do
  _Limit 50
  x$ = InKey$
  If Len(x$) Then Exit Do
Loop
Timer(t6) Off
End

Sub CPUtrap
  S$ = Str$(Int(GetCPULoad * 10000) / 100) ' 100.00
  If InStr(S$, ".") Then
      Q$ = Mid$(S$, InStr(S$, ".") + 1)
      S$ = Left$(S$, InStr(S$, ".") - 1)
      Q$ = Left$(Q$, 3)
      S$ = S$ + "." + Q$
  Else
      S$ = S$ + ".0"
  End If
  D$ = "CPU " + S$ + "%" ' 100.00
  Cls
  Print D$
End Sub


Attached Files
.bi   mem.bi (Size: 3.17 KB / Downloads: 71)
Reply


Messages In This Thread
New and improved SICK project - by eoredson - 09-20-2022, 04:44 AM
RE: New and improved SICK project - by mnrvovrfc - 09-24-2022, 02:52 AM
RE: New and improved SICK project - by mnrvovrfc - 09-24-2022, 08:06 PM
RE: New and improved SICK project - by eoredson - 09-27-2022, 06:21 AM
RE: New and improved SICK project - by eoredson - 09-28-2022, 03:11 AM
RE: New and improved SICK project - by mnrvovrfc - 09-28-2022, 04:39 AM
RE: New and improved SICK project - by eoredson - 09-28-2022, 05:03 AM
RE: New and improved SICK project - by mnrvovrfc - 10-06-2022, 11:34 PM
RE: New and improved SICK project - by mnrvovrfc - 09-28-2022, 07:02 PM
RE: New and improved SICK project - by Pete - 09-28-2022, 03:48 PM
RE: New and improved SICK project - by aurel - 09-28-2022, 09:34 PM
RE: New and improved SICK project - by eoredson - 09-29-2022, 04:45 AM
RE: New and improved SICK project - by Pete - 09-28-2022, 09:46 PM
RE: New and improved SICK project - by mnrvovrfc - 09-30-2022, 04:25 PM
RE: New and improved SICK project - by eoredson - 10-01-2022, 02:30 AM
RE: New and improved SICK project - by eoredson - 10-01-2022, 03:58 AM
RE: New and improved SICK project - by mnrvovrfc - 10-04-2022, 02:20 PM
RE: New and improved SICK project - by eoredson - 10-06-2022, 12:44 AM
RE: New and improved SICK project - by mnrvovrfc - 10-06-2022, 05:12 AM
RE: New and improved SICK project - by aurel - 10-06-2022, 07:09 PM
RE: New and improved SICK project - by mnrvovrfc - 10-06-2022, 08:05 PM
RE: New and improved SICK project - by bplus - 10-06-2022, 07:46 PM
RE: New and improved SICK project - by aurel - 10-07-2022, 11:39 AM
RE: New and improved SICK project - by aurel - 10-07-2022, 12:00 PM
RE: New and improved SICK project - by mnrvovrfc - 10-07-2022, 11:41 PM
RE: New and improved SICK project - by mnrvovrfc - 10-12-2022, 05:19 PM
RE: New and improved SICK project - by eoredson - 10-21-2022, 03:15 AM
RE: New and improved SICK project - by mnrvovrfc - 10-21-2022, 07:03 AM
RE: New and improved SICK project - by eoredson - 03-11-2023, 04:34 AM
RE: New and improved SICK project - by eoredson - 04-07-2023, 03:52 AM



Users browsing this thread: 14 Guest(s)