Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Retrieving list of available disk drives
Simple Window Viewer
Converting command-line string to a set of Unicode argument strings (WinNT only)
Displaying dimmed window behind VFP top-level form
Displaying the associated icons and descriptions for files and folders
How to delete IE cookies, clear IE history and delete files in Temporary Internet Files directory
Obtaining physical parameters for a drive: sectors, clusters, cylinders...
Retrieving the command line for the VFP session
Using the RestartDialog function -- restarting Windows
Disconnecting USB Mass Storage Device programmatically
Displaying printer-properties Property Sheet for the specified printer
Drawing standard Windows icons
How to obtain the number of rows affected by remote UPDATE, INSERT or DELETE statement
Listing INF files in a specified directory
Retrieving names for the registered clipboard formats
Accessing Windows Control Panel from VFP Application
Drawing a rectangle using Windows regular edges and borders
Enumerating the subkeys of a user-specific key
Extended MessageBox Class
Winsock: reading and setting socket options
Accessing examples contained in this reference from a VFP application
Dial the Net Automatically
Get the power status of your laptop computer
How to retrieve network parameters for the local computer (including Host name, Domain name, and DNS Server)
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
 
#DEFINE PROCESS_QUERY_INFORMATION 0x0400
#DEFINE PROCESS_VM_READ 4
DO declare
 
* retrieve a handle to the current process
hProcess = OpenProcess(;
    BITOR(PROCESS_QUERY_INFORMATION,PROCESS_VM_READ),;
    0, GetCurrentProcessId()) && application.ProcessId
 
IF hProcess = 0
    ? "OpenProcess failed:", GetLastError()
    RETURN
ENDIF
 
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)
 
PROCEDURE declare
    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: 72  
Listed functions:
CloseHandle
GetCurrentProcessId
GetLastError
GetProcessIoCounters
OpenProcess
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  
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.16.17.90)
27.62 min.Example: 'GDI+: how to make VFP controls visually shake and shudder'
2.49 hrs.Example: 'How to create non-blocking Winsock server'
Language: 'C++'
 Example: 'How to block the PrintScreen key'
3.76 hrs.Examples
Page 12
 Example: 'Downloading files from the FTP server using InternetReadFile'
4.22 hrs.Function: 'GdipCreateFromHDC'
 Example: 'Sending email messages with Simple MAPI'
5.2 hrs.Function: 'SHRegOpenUSKey'
Function group: 'Registry'
8.95 hrs.Example: 'Winsock: retrieving the host information corresponding to a network address'
 
Function group: 'Atom'
Google
Advertise here!