Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Using the ChooseColor function
Adding and deleting User Accounts
Creating a device context for the specified printer
Drawing a rectangle using Windows regular edges and borders
Enumerating Processes -- WinNT
How to enumerate, add and delete shares on the local computer (WinNT/XP)
Obtaining OS memory performance information
Quering waveform-audio output devices
Starting external program from VFP and waiting for its termination
The window and its ancestors
Using EnumPrinters function to enumerate locally installed printers
Adding and deleting Scheduled Tasks using NetScheduleJob API functions
Confining Windows calculator inside the VFP main window
Drawing Windows predefined bitmaps using the LoadBitmap functions
Exporting DLL icon resources as .ICO files
How to browse and connect to printers on a network (WinNT)
How to delete all print jobs for a printer
How to download a file from HTTP server using URL Monikers functions
How to load a user profile
How to view system icons for the classes installed on the local machine
Obtaining I/O counts for the current process
Retrieving configuration information for the specified server (Win2000/XP)
Setting the mouse capture to the specified window
Creating a window using CreateWindowEx function
Obtaining I/O counts for the current process

User rating: 7/10 (1 votes)
Rate this code sample:
  • ~
More code examples    Listed functions    Add comment     W32 Constants      Translate this page Printer friendly version of this code sample
DO declare

* retrieve a handle to the current process
hProcess = OpenProcess(;
    0, GetCurrentProcessId()) && application.ProcessId

IF hProcess = 0
    ? "OpenProcess failed:", GetLastError()

LOCAL cBuffer
cBuffer = REPLICATE(CHR(0), 48)
= GetProcessIoCounters(hProcess, @cBuffer)

? "ReadOperationCount:", buf64ToNum(SUBSTR(cBuffer,1,8))
? "WriteOperationCount:", buf64ToNum(SUBSTR(cBuffer,9,8))
? "OtherOperationCount:", buf64ToNum(SUBSTR(cBuffer,17,8))
? "ReadTransferCount:", buf64ToNum(SUBSTR(cBuffer,25,8))
? "WriteTransferCount:", buf64ToNum(SUBSTR(cBuffer,33,8))
? "OtherTransferCount:", buf64ToNum(SUBSTR(cBuffer,41,8))

= CloseHandle(hProcess)
* end of main

FUNCTION buf64ToNum(cBuffer)
    LOCAL nLo, nHi
    nLo = buf2dword(SUBSTR(cBuffer,1,4))
    nHi = buf2dword(SUBSTR(cBuffer,5,4))
RETURN m.nLo + m.nHi * (0xffffffff+1)

FUNCTION buf2dword(lcBuffer)
RETURN Asc(SUBSTR(lcBuffer, 1,1)) + ;
    BitLShift(Asc(SUBSTR(lcBuffer, 2,1)),  8) +;
    BitLShift(Asc(SUBSTR(lcBuffer, 3,1)), 16) +;
    BitLShift(Asc(SUBSTR(lcBuffer, 4,1)), 24)

    DECLARE INTEGER GetLastError IN kernel32
    DECLARE INTEGER GetCurrentProcessId IN kernel32
    DECLARE INTEGER CloseHandle IN kernel32 INTEGER hObject

    DECLARE INTEGER OpenProcess IN kernel32;
        INTEGER dwDesiredAccess,;
        INTEGER bInheritHandle, INTEGER dwProcId

    DECLARE INTEGER GetProcessIoCounters IN kernel32;
        INTEGER hProcess, STRING @lpIoCounters

User rating: 7/10 (1 votes)
Rate this code sample:
  • ~
1586 bytes  
Created: 2008-03-26 17:14:26  
Modified: 2008-03-26 17:16:36  
Visits in 7 days: 75  
Listed functions:
Printer friendly API declarations
My comment:
The IO_COUNTERS structure contains I/O accounting information for a process or a job object. For a job object, the counters include all operations performed by all processes that have ever been associated with the job, in addition to all processes currently associated with the job.
Word Index links for this example:
Translate this page:
  Spanish    Portuguese    German    French    Italian offers instant, free translations of text or web pages.
User Contributed Notes:
There are no notes on this subject.

Copyright 2001-2015 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.5.44), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
Last Topics Visited (
23 sec.Example: 'Monitoring changes occurring within a directory'
Language: 'C#'
1.2 min.Example: 'GDI+: sending image of FoxPro form to printer'
1 day(s)Example: 'How to display Windows On-Screen Keyboard'
Language: 'C++'
 Function: 'CloseWindow'
Function group: 'Window'
 Function: 'GetIconInfo'
 Example: 'How to change display settings: screen resolution, screen refresh rate'
Advertise here!