Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
GDI+: saving image of FoxPro form to graphics file (BMP, GIF, JPG, PNG, TIF)
How to disable the Windows Clipboard (VFP9)
How to display the Properties dialog box for a file (ShellExecuteEx)
How to hot-track menu item selection in top-level form (requires VFP9)
How to make a VFP form fading out when released (GDI+ version)
Pocket PC: creating new database in the Object Store and copying Contacts Database records into it
Quering waveform-audio output devices
Reading current hardware profile
Tracking mouse movement to detect when to start dragging
Using Path functions from Shell Lightweight Utility APIs (shlapi.dll)
Using the GradientFill function
Winsock: changing the byte ordering
Adding and deleting User Accounts
Copying strings through the global memory block
Creating a window using CreateWindowEx function
Drawing Windows predefined bitmaps using the LoadBitmap functions
How to retrieve version information for the specified file
How to view system icons for the classes installed on the local machine
Obtaining Shell32.dll version
PocketPC: creating directories and files
Reading VFP settings from the Windows Registry
Retrieving the IP-to-physical address mapping table
System Image List Viewer
Uploading file to the FTP server using InternetWriteFile
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: 83  
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-2014 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.68), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
Last Topics Visited (54.90.110.60)
4 sec.Function: 'GetTextExtentPoint32'
4 hrs.Function: 'CryptHashData'
Function group: 'Cryptography Reference'
 Function: 'mixerGetDevCaps'
Function group: 'Windows Multimedia'
 Function: 'WSAStartup'
4.03 hrs.Function: 'midiOutGetDevCaps'
Function group: 'Windows Multimedia'
3 day(s)Example: 'Terminating all running applications from a VFP program'
 Function: 'CryptGetProvParam'
Function group: 'Cryptography Reference'
 Example: 'Basic Volume information'
Google
Advertise here!