Hi Mockey,

thank you very much - works perfect - without any delay when 
moving bars or notes. In my info-bar, i can now see cpu-usage: total, 
0 and 1. 

Best regards Detlef


I replaced my old coding in my monitor-script as follows:

;------------------------------------------------------------------*
; Set color depending on CPU-Usage
;------------------------------------------------------------------*
static s_cpu_t
local  l_cpu_0 l_cpu_1 l_err
if(not s_cvx)do
   static s_hcpu0 s_hcpu1 s_hquery
   global g_cpuus g_cpu_t
   s_cvx  = dll.create_struct("ui[2] i")
   l_err  = dll.call("pdh.dll|PdhOpenQuery|s! ui ui*", "", 0, 
"s_hquery")
   l_err  = dll.call("pdh.dll|PdhAddCounterA|ui s ui ui*", s_hquery,
 ?"\Prozessor(0)\Prozessorzeit (%)", 0, "s_hcpu0")
   l_err  = dll.call("pdh.dll|PdhAddCounterA|ui s ui ui*", s_hquery,
 ?"\Prozessor(1)\Prozessorzeit (%)", 0, "s_hcpu1")
endif
l_err   = dll.call("pdh.dll|PdhCollectQueryData|ui", s_hquery)
l_err   = dll.call("pdh.dll|PdhGetFormattedCounterValue|ui ui ui 
t*",s_hcpu0, 0x100, 0, s_cvx)
l_cpu_0 = s_cvx[3]
l_err   = dll.call("pdh.dll|PdhGetFormattedCounterValue|ui ui ui 
t*",s_hcpu1, 0x100, 0, s_cvx)
l_cpu_1 = s_cvx[3]
g_cpu_t = (l_cpu_0 + l_cpu_1) / 2
g_cpuus = g_cpu_t ++ "% (" ++ l_cpu_0 ++ "/" ++ l_cpu_1 ++ ")"
if(g_cpu_t != s_cpu_t)do
    if(l_cpu_0 >= 80 or l_cpu_1 >= 80) do
       cl.SetBackColor("DLB - Info","cpuusage",255,0,0)
    else
       cl.SetBackColor("DLB - Info","cpuusage")
    endif
    s_cpu_t = g_cpu_t
endif

Reply via email to