Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Creating a clipping region from the path selected into the device context of a form
GDI+: saving image of FoxPro form to graphics file (BMP, GIF, JPG, PNG, TIF)
Monitoring changes occurring within a directory
Retrieving list of available disk drives
Current keyboard type
Enumerating ports that are available for printing on a specified server
How to create a desktop shortcut (shell link)
How to delete IE cookies, clear IE history and delete files in Temporary Internet Files directory
Monitoring changes in a directory
Retrieving the User Datagram Protocol (UDP) listener table
Testing serial ports
Using FtpCommand
Winsock: retrieving the standard host name and IP address for the local machine
Displaying printer-properties Property Sheet for the specified printer
Enumerating the subkeys of a user-specific key
Obtaining some properties for the Windows desktop using the GetWindowPlacement function
Displaying dimmed window behind VFP top-level form
Displaying icons in the system tray (VFP9)
How to make the caption of a VFP application flashing in the Windows task bar
How to register custom Event Log source
The SQLGetProp() creates a bridge between Visual FoxPro and the ODBC API
Using the SetErrorMode for determining if a floppy drive is ready
Displaying hypertext links with the SysLink control (VFP9, Comctl32.dll)
Get the power status of your laptop computer
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: 86  
    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 (50.19.155.235)
    4 sec.Function: 'FillMemory'
    42.55 min.Function: 'DragQueryFile'
    Function group: 'Shell Functions'
    42.6 min.Example: 'Starting external program from VFP and waiting for its termination'
    1.27 hrs.Example: 'Extensible Storage Engine class library'
    2.2 hrs.Example: 'Winsock: changing the byte ordering'
     Example: 'Reading entries from Event logs'
     Function: 'WNetCloseEnum'
    5.04 hrs.Example: 'Smart Card Database Query Functions'
    5.74 hrs.Function: 'SetMapMode'
    Function group: 'Coordinate Space and Transformation'
     Example: 'Using the CopyFile'
    Google
    Advertise here!