SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 4 of 4

Thread: VBA CPU Usage

  1. #1
    Member
    Join Date
    Jun 2008
    Location
    Tha Planetz
    Posts
    38
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    VBA CPU Usage

    What's the best way to fetch the CPU usage at a certain point in time from a regular TP script?

    Thanks

  2. #2
    Senior Member
    Join Date
    Aug 2008
    Posts
    137
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: VBA CPU Usage

    WMI!

    *Warning*

    This script is an infinite loop. Remember that ALT-F12 stops scripts

    <font class="small">Code:</font><hr /><pre>
    Sub Main()

    ' Create and display the TTextPanel object.
    Dim panel As TTextPanel

    ' Set the position, size and color of the panel.

    Do
    strComputer = "."
    Set objWMIService = GetObject("winmgmts:\\" &amp; strComputer &amp; "\root\CIMV2")
    Set colItems = objWMIService.ExecQuery( _
    "SELECT * FROM Win32_Processor", , 48)
    For Each objItem In colItems
    Set panel = TextPanel("LoadPercentage: " &amp; objItem.LoadPercentage, Left:=50, Top:=50, Width:=200, Height:=200)
    panel.BackgroundColor = RGB(0, 0, 255)
    panel.ForegroundColor = RGB(255, 255, 255)

    Next
    Loop
    End Sub


    [\code]
    -Steve

  3. #3
    Senior Member
    Join Date
    Aug 2008
    Posts
    137
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: VBA CPU Usage

    Btw, you might want to check out:

    Microsoft WMI Creator v1.0
    -Steve

  4. #4
    Member
    Join Date
    Jun 2008
    Location
    Tha Planetz
    Posts
    38
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: VBA CPU Usage

    Wow!! This is great stuff!!

    Thanks for sharing the excellence of WMI.

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 11.11%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 05:45 AM.

Copyright BetaSoft Inc.