Using Win32 functions in Visual FoxPro Image Gallery
Registry
..msdn
GetPrivateProfileSectionNames
GetPrivateProfileString
GetProfileString
RegCloseKey
RegCreateKeyEx
RegDeleteKey
RegDeleteValue
RegEnumKey
RegEnumKeyEx
RegEnumValue
RegOpenKeyEx
RegQueryInfoKey
RegQueryValueEx
RegSaveKey
RegSetValueEx
SHEnumKeyEx
SHRegCloseUSKey
SHRegEnumUSKey
SHRegOpenUSKey
WritePrivateProfileSection
WritePrivateProfileString
Code examples:
Enumerating Performance Counters
Testing MS Internet Explorer version installed
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: 49  
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 (184.73.74.47)
2 sec.Function: 'StartPage'
Function group: 'Printing and Print Spooler'
7.28 min.Example: 'Simulating DOEVENTS'
7.33 min.Function: 'GetPrintProcessorDirectory'
Function group: 'Printing and Print Spooler'
28.18 min.Function: 'SetThreadExecutionState'
Function group: 'Power Management'
28.23 min.Example: 'GDI+: creating scaled copy of image file'
5.33 hrs.Example: 'Reading parameters of streams in AVI file'
 Function: 'LoadIcon'
 Example: 'Pocket PC: base class'
5.56 hrs.Example: 'Pocket PC: custom RAPI class for operating with the System Registry'
 Example: 'Storing screen shot of a form to enhanced metafile (*.emf)'
Google
Advertise here!