Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
GDI+: Storing content of the Clipboard to a bitmap file
Creating a directory on the FTP
How to block the PrintScreen key
How to view system icons for the classes installed on the local machine
How to write and read Window Properties for the specified window
Obtaining a handle to the desktop associated with the calling thread
Starting an external application in VFP using WinExec
Using InternetSetFilePointer when resuming interrupted download from the Internet
Drawing Windows frame controls using the DrawFrameControl function
How to disable the Windows Clipboard (VFP9)
How to display a dialog box with which the user can add a data source (DSN)
Scanning the hierarchy of child windows down from the main VFP window
Start an executable from VFP application by using the CreateProcess
Displaying printer-properties Property Sheet for the specified printer
How to enumerate sessions and processes on a specified terminal server
Obtaining addresses for the adapters on the local computer (Win XP/2003/Vista)
Placing a button on the VFP form as a new child window
Testing Clipboard functions: emptying the clipboard
Comparing file times
Converting Unicode data from the Clipboard to a character string using a given code page
Creating the Save dialog box to specify the drive, directory, and name of a file to save
How to block the ALT+TAB shortcut (WinXP)
How to browse and connect to printers on a network (WinNT)
How to download a file from HTTP server using URL Monikers functions
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: 76  
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-2017 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.37), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
Last Topics Visited (
16 sec.Function: 'CeRapiGetError'
Function group: 'Remote Application Programming (RAPI)'
31 sec.Example: 'Storing content of the Clipboard to a bitmap file'
47 sec.Example: 'Pocket PC: base class'
1.05 min.Example: 'Windows Shell Icons displayed and exported to ICO files (Vista)'
1.37 min.Example: 'Retrieving top-child window for the VFP form'
1.65 min.Function: 'RegEnumKey'
Function group: 'Registry'
1.92 min.Function: 'LogonUser'
2.18 min.Function: 'GlobalAlloc'
Function group: 'Memory Management'
2.8 min.
Function group: 'Message and Message Queue'
3.13 min.Function: 'WriteFile'
Function group: 'File Management'
Advertise here!