Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
High-powered ALLTRIM
Obtaining MAC address through Address Resolution Protocol (ARP) request
Retrieving System Error message strings
Current directory of the application
Winsock: how to retrieve the protocol information corresponding to a protocol name
DiskFreeSpace class
GetProcessVersion points at target OS
Setting the volume label
Using the GetTempFileName
Accessing the list of Windows Recent Documents
Another way to go online (it is not about choosing an ISP)
Converting twips to pixels and vice versa
Creating two-byte hashes for a list of URLs
Dial the Net Automatically
Extracting the name and extension parts of a path string
How to hide your program from the Close Program dialog (Win9* only)
How to play a waveform sound (a WAV file in particular)
Reading keys in the specified section of the Win.ini file
Saving available locale records into a cursor
Setting and retrieving the double-click time for the mouse
Using Multimedia Command Strings to play MIDI files
Creating a unique filename based on existing filename
Enumerating files opened on the network
Enumerating the subkeys of a user-specific key
Memory usage info for current VFP session (WinNT only)

User rating: 8.5/10 (2 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:
See also:
  • Obtaining memory performance information for the system
  •  
    DO decl
    *| typedef struct _PROCESS_MEMORY_COUNTERS {
    *|     DWORD cb;
    *|     DWORD PageFaultCount;
    *|     SIZE_T PeakWorkingSetSize;
    *|     SIZE_T WorkingSetSize;
    *|     SIZE_T QuotaPeakPagedPoolUsage;
    *|     SIZE_T QuotaPagedPoolUsage;
    *|     SIZE_T QuotaPeakNonPagedPoolUsage;
    *|     SIZE_T QuotaNonPagedPoolUsage;
    *|     SIZE_T PagefileUsage;
    *|     SIZE_T PeakPagefileUsage;
    *| } PROCESS_MEMORY_COUNTERS;  4 x 10 = 40 bytes
    *| typedef PROCESS_MEMORY_COUNTERS *PPROCESS_MEMORY_COUNTERS
    #DEFINE STRU_LENGTH   40
    #DEFINE HANDLE_FLAG_INHERIT  1
    #DEFINE HANDLE_FLAG_PROTECT_FROM_CLOSE  2
     
    PRIVATE lcBuffer
    LOCAL hProcess, nFlags
     
    hProcess = GetCurrentProcess()
     
    nFlags = 0
    = GetHandleInformation(hProcess, @nFlags)
    ? "Object Handle flags:", nFlags
    ?
     
    lcBuffer = Chr(STRU_LENGTH) + Repli(Chr(0), STRU_LENGTH-1)
     
    IF GetProcessMemoryInfo (hProcess, @lcBuffer, STRU_LENGTH) <> 0
    *    = _print ("Size of the structure, in bytes:",  1)
        = _print ("Number of page faults:          ",  5)
        = _print ("Peak working set size:          ",  9)
        = _print ("Current working set size:       ", 13)
        = _print ("Peak paged pool usage:          ", 17)
        = _print ("Current paged pool usage:       ", 21)
        = _print ("Peak nonpaged pool usage:       ", 25)
        = _print ("Current nonpaged pool usage:    ", 29)
        = _print ("Current pagefile usage:         ", 33)
        = _print ("Peak pagefile usage:            ", 37)
    ENDIF
     
    PROCEDURE _print (lcCaption, lnOffs)
        LOCAL lnValue
        lnValue = buf2dword(SUBSTR(lcBuffer, lnOffs,4))
        ? lcCaption, TRANS(lnValue, "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
     
    PROCEDURE decl
        DECLARE INTEGER GetProcessMemoryInfo IN psapi;
            INTEGER Process, STRING @ppsmemCounters, INTEGER cb
     
        DECLARE INTEGER GetCurrentProcess IN kernel32
     
        DECLARE INTEGER GetHandleInformation IN kernel32;
            INTEGER hObject, INTEGER @lpdwFlags
     
     
     

    User rating: 8.5/10 (2 votes)
    Rate this code sample:
    • ~
    2057 bytes  
    Created: 2001-10-25 20:54:42  
    Modified: 2010-07-12 02:55:22  
    Visits in 7 days: 65  
    Listed functions:
    GetCurrentProcess
    GetHandleInformation
    GetProcessMemoryInfo
    Printer friendly API declarations
    My comment:
    WinNT Performance Monitor
    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 (54.234.180.187)
    12.97 min.Example: 'How to create non-blocking Winsock server'
    13.03 min.Function: 'RegisterRawInputDevices'
    1.93 hrs.
    Function group: 'Menu'
     Example: 'Accessing examples contained in this reference from a VFP application'
    5.19 hrs.Example: 'How to print picture stored in enhanced-format metafile (*.emf)'
     Function: 'GetShortPathName'
    5.67 hrs.Function: 'GdipGetImageHorizontalResolution'
    Function group: 'GDI+ Image'
     Function: 'SwitchToThisWindow'
    Function group: 'Window'
    6.07 hrs.Example: 'How to display the Properties dialog box for a file (ShellExecuteEx)'
     
    Google
    Advertise here!