Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Pocket PC: creating backup for the System Registry
Reading keys in the specified section of the Win.ini file
Terminating VFP application using the FatalAppExit
Using GetBinaryType (WinNT only) to determine the type of an executable file
Dynamic strings implemented through VFP Custom class
Enumerating ODBC drivers available on the local computer
Retrieving geometrical parameters of the system desktop window
Enumerating connections made to a shared resource for the local computer (WinNT only)
How to drag a Form not using its Titlebar or Caption
Retrieving the System Time adjustment
Searching for the specified file using the SearchPath
Another way to go online (it is not about choosing an ISP)
Displaying the main Dial-Up Networking dialog box
PocketPC: creating directories and files
An alternative way of setting Form.Closable to False
GDI+: Using Scale and Shear transformations
How to test file attributes (key method for FileExists and DirectoryExists routines)
Converting path to original case
How to fill a buffer with random bytes using Cryptography API Functions
How to intercept window messages sent to VFP form
Using the GetLogicalDriveStrings
GDI+: converting text strings to images and saving in a graphics file
Power capabilities of the system: battery, UPS, sleep and hibernation modes, processor throttling
Reading STARTUPINFO structure for the current VFP session
Enumerating Performance Counters

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
More code examples    Listed functions    Add comment     W32 Constants      Translate this page Printer friendly version of this code sample
Before you begin:
The counter is the mechanism by which performance data is collected.

The registry stores the names of all the counters, each of which is related to a specific area of system functionality.

Examples include a processor usage, memory usage, or the number of bytes received over a network connection.

 
#DEFINE HKEY_PERFORMANCE_DATA 0x80000004
#DEFINE HKEY_PERFORMANCE_TEXT 0x80000050
#DEFINE HKEY_PERFORMANCE_NLSTEXT 0x80000060
 
DO declare
 
DO EnumCounters WITH "Help", "csCounterHelpStrings"
 
DO EnumCounters WITH "Counter", "csCounterNames"
 
* end of main
 
FUNCTION EnumCounters(cValueName As String, cCursorName As String)
 
    LOCAL cBuffer, nBufSize, hKey
    nBufSize=0
    hKey=HKEY_PERFORMANCE_NLSTEXT
 
    = RegQueryValueEx(m.hKey, cValueName,;
        0, 0, NULL, @nBufSize)
 
    cBuffer = REPLICATE(CHR(0), nBufSize)
 
    = RegQueryValueEx(m.hKey, cValueName,;
        0, 0, @cBuffer, @nBufSize)
 
    nCount = ALINES(arrCounters, cBuffer, CHR(0))
 
    CREATE CURSOR csTempCounter (stringId I, stringValue C(250))
 
    FOR nIndex=1 TO 2 * INT(nCount/2) STEP 2
        INSERT INTO csTempCounter (stringId, stringValue);
        VALUES ( VAL(arrCounters[nIndex]), arrCounters[nIndex+1])
    NEXT
 
    SELECT stringId, MAX(stringValue) As stringValue;
    FROM csTempCounter;
    WHERE NOT EMPTY(stringId);
    GROUP BY 1;
    ORDER BY 1;
    INTO CURSOR (m.cCursorName) NOFILTER READWRITE
 
    BROWSE NORMAL NOWAIT
 
    USE IN csTempCounter
 
* end of main
 
PROCEDURE declare
    DECLARE INTEGER RegQueryValueEx IN advapi32;
        INTEGER hKey, STRING lpValueName,;
        INTEGER lpReserved, INTEGER @lpType,;
        STRING @lpData, INTEGER @lpcbData
 

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
1317 bytes  
Created: 2010-07-01 09:19:11  
Modified: 2010-07-01 09:28:41  
Visits in 7 days: 40  
Listed functions:
RegQueryValueEx
Printer friendly API declarations
My comment:
To retrieve the names or help text, call the RegQueryValueEx function.

Set the hKey parameter to either of three HKEY_PERFORMANCE keys. Set the lpValueName parameter to either "Counter" or "Help" to retrieve the names or help text, respectively.

Read MSDN article Retrieving Counter Names and Help Text.
Word Index links for this example:
Translate this page:
  Spanish    Portuguese    German    French    Italian  
FreeTranslation.com offers instant, free translations of text or web pages.
User Contributed Notes:
There are no notes on this subject.


Copyright © 2001-2013 News2News, Inc. Before reproducing or distributing any data from this site please ask for an approval from its owner. Unless otherwise specified, this page is for your personal and non-commercial use. The information on this page is presented AS IS, meaning that you may use it at your own risk. Microsoft Visual FoxPro and Windows are trade marks of Microsoft Corp. All other trademarks are the property of their respective owners. 

Privacy policy
Credits: PHP (4.4.9), an HTML-embedded scripting language, MySQL (5.1.55-log), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
Last Topics Visited (107.20.7.65)
4 sec.Example: 'Listing INF files in a specified directory'
25.63 min.Function: 'RegCloseKey'
25.68 min.Example: 'Wininet last error description'
25.75 min.Example: 'Using the CreateFile'
Google
Advertise here!