Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Attaching menu to a top-level form
GDI+: Creating thumbnails to preview images in a directory
How to download this reference`s archive through WinInet functions using InternetOpenUrl
Retrieving information about the main VFP window
Using the heap of the calling process to allocate memory blocks
Using WM_COPYDATA for interprocess communication (VFP9)
Drawing Windows frame controls using the DrawFrameControl function
How to read email messages using Simple MAPI
Retrieving Printer Device Context using PrintDlg function
Creating irregularly shaped FoxPro form using transparency color key
Enumerating the subkeys for a given registry key
GDI+: converting image file to another graphics format
HOWTO: Use the Win32 API to Access File Dates and Times
Using Change Notification Objects to monitor changes to the printer or print server
Start an executable from VFP application by using the CreateProcess
Printing text on the main VFP window
Adding and deleting User Accounts
GDI+: cropping images
How to download a file from the FTP server using FtpGetFile
Reading VFP settings from the Windows Registry
Setting default printer
Drawing a window caption using the DrawCaption routine
Finding the application, icon and friendly names associated with a file name
How to enumerate cookies and URL History entries in the cache of the local computer
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: 149  
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-2018 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.6.38), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
Last Topics Visited (
3 sec.Function: 'CeSeekDatabase'
Function group: 'Remote Application Programming (RAPI)'
5 sec.Example: 'How to delete a service object'
8 sec.
Function group: 'Kernel Transaction Manager'
9 sec.Function: 'CopyIcon'
11 sec.Function: 'GetProcessHeap'
13 sec.Function: 'CeRapiInit'
Function group: 'Remote Application Programming (RAPI)'
15 sec.Function: 'GetSubMenu'
Function group: 'Menu'
16 sec.Function: 'capCreateCaptureWindow'
Function group: 'Windows Multimedia'
18 sec.Function: 'getnameinfo'
Function group: 'Windows Sockets 2 (Winsock)'
20 sec.Function: 'HeapFree'
Advertise here!