Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting CPU usage information
Message
 
To
23/01/2004 05:07:37
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00869557
Message ID:
00869829
Views:
13
The one about Getting memory information will give you information about memory usage, available, etc on the machine. I thought it might get you started...
DECLARE GlobalMemoryStatus IN kernel32 STRING @ lpBuffer  

lpBuffer = REPLI (Chr(0), 250)  
= GlobalMemoryStatus (@lpBuffer)  

= _display ("This buffer length, in bytes ..........:",  1) 
= _display ("Memory in use, % ......................:",  5) 
= _display ("Physical memory, in bytes .............:",  9) 
= _display ("Physical memory available, in bytes ...:", 13) 
= _display ("Committed memory limit, in bytes ......:", 17) 
= _display ("Available memory to commit, in bytes ..:", 21) 
= _display ("User mode portion..., in bytes ........:", 25) 
= _display ("Unreserved/uncommitted memory .........:", 29) 

PROCEDURE  _display (lcCaption, lnOffs) 
    ? lcCaption + TRANS(buf2dword(SUBSTR(lpBuffer,lnOffs,4)),; 
        "999,999,999,999,999,999") 
RETURN 

FUNCTION  buf2dword (lcBuffer) 
RETURN; 
    Asc(SUBSTR(lcBuffer, 1,1)) + ; 
    Asc(SUBSTR(lcBuffer, 2,1)) * 256 +; 
    Asc(SUBSTR(lcBuffer, 3,1)) * 65536 +; 
    Asc(SUBSTR(lcBuffer, 4,1)) * 16777216 
ENDFUNC 
I did a google search on globalmemorystatus and looked at the subject on msdn - then I did a little research around that area on the site and found these...

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/system_information_functions.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/system_info_str.asp





>Hi Wayne, thanks for replying!
>
>>Look in the September 03 UT Magazine VFP Tips - might get you started.
>
>Did that, but just see tips on "Positioning an item in a listbox", "Calculations using Money (Currency)", "Setting Time on the Local Machine" and "Getting Information About Memory on a Computer".
>
>Pardom me if I missed something in your message.
>
>Could you help me a bit further?
>
>Regards,
>
>Fernando
>
>>
>>>Hi,
>>>
>>>There is a means for an app to call the Windows API to get information about CPU utilization (and some other figures - memory, number of processes etc - as well) in the PC it is running?
>>>
>>>Thanks in advance for any tip.
>>>
>>>Fernando
Wayne Myers, MCSD
Senior Consultant
Forte' Incorporated
"The only things you can take to heaven are those which you give away" Author Unknown
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform