Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Adding an ODBC data source with the SQLConfigDataSource; use automatic or interactive mode
Converting Unicode data from the Clipboard to a character string using a given code page
Displaying system dialog that selects a folder
Enumerating print jobs and retrieving information for default printer (JOB_INFO_1 structures)
Enumerating printer drivers installed
How to build UDP responder
How to remove a directory that is not empty
How to retrieve the number of print jobs queued for the printer
Locking the workstation
Scanning a hierarchy of child windows down from the Windows Desktop
Using the MessageBox Win32 function
Winsock: reading and setting socket options
Accessing LSA Policy object (Local Security Authority)
Creating a directory on the FTP
Displaying OS Memory Status
Getting a bit more than the _CLIPTEXT offers
How to activate Windows Calculator
How to detect if additional monitor is connected and active
How to download this reference`s archive through WinInet functions using InternetOpenUrl
How to retrieve version information for the specified file
URL: splitting into its component parts
Using the Semaphore object
Creating a mailslot
Displaying printer-properties Property Sheet for the specified printer
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: 48  
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-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 (54.198.147.221)
7 sec.Function: 'InternetDial'
Function group: 'Internet Functions (WinInet)'
13 sec.Function: 'NetShareAdd'
19 sec.Function: 'CryptStringToBinary'
26 sec.Function: 'inet_addr'
Function group: 'Windows Sockets 2 (Winsock)'
33 sec.Function: 'CreateFont'
40 sec.Example: 'How to Start a Process as Another User (NT/XP/2K)'
46 sec.Function: 'NetWkstaUserEnum'
Function group: 'Network Management'
52 sec.Function: 'CeRapiGetError'
Function group: 'Remote Application Programming (RAPI)'
57 sec.Example: 'Testing serial ports'
1.07 min.Function: 'NetScheduleJobDel'
Function group: 'Network Management'
Google
Advertise here!