Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Using the GetLogicalDriveStrings
Current directory of the application
How to fill a buffer with random bytes using Cryptography API Functions
Retrieving geometrical parameters of the system desktop window
PocketPC: creating directories and files
Retrieving national language settings
Using LoadLibrary
Retrieving current user for the process
Converting characters to upper or lower case
Retrieving default spooling directory name
Accessing the list of Windows Recent Documents
GDI+: converting text strings to images and saving in a graphics file
How to intercept window messages sent to VFP form
Dynamic strings implemented through VFP Custom class
How to access a file using not its name but an alias (hard link)
List of ODBC drivers installed (read from the [ODBC Drivers] section)
Managing Cookies
Retrieving the rectangle area where the mouse cursor is confined
Finding the application, icon and friendly names associated with a file name
Retrieving list of supported paper names (for example, Letter or Legal) for a given printer
Saying "Hello World!" with VFP and WinAPI
Obtaining window class name for the main VFP window
Setting the Window Region for a form
Creating two-byte hashes for a list of URLs
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: 36  
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.21.156.140)
3 sec.Example: 'Retrieving the name of the primary domain controller (PDC) and join status information (NT/2000/XP)'
33.33 min.Function: 'InternetAttemptConnect'
Function group: 'Internet Functions (WinInet)'
33.38 min.
53.25 min.Example: 'How to display Windows On-Screen Keyboard'
53.32 min.Function: 'SHGetSpecialFolderLocation'
Function group: 'Shell Functions'
53.37 min.Example: 'Enumerating print processors and supporting data types installed on the specified server'
1.24 hrs.Example: 'Enumerating print jobs and retrieving information for default printer (JOB_INFO_1 structures)'
1.62 hrs.Function: 'MAPIResolveName'
Function group: 'Simple MAPI'
 Example: 'How to create transparent areas inside a form -- punching holes in the form'
1.72 hrs.Example: 'Using vendor-neutral SQL constructs'
Google
Advertise here!