Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Yet another modal dialog: now HTML-based
Changing file attributes
GetFocus returns a HWND value
Reading VFP settings from the Windows Registry
Retrieving list of all active RAS connections
DiskFreeSpace class
Displaying the drive type value
Drawing standard Windows icons
Enumerating global and local group accounts on a server (WinNT/XP/2K)
GDI+ fun: roach-infested desktop
How to find the application associated with a file name
Printing text on the client area of the main VFP window
Reading and setting Environment variables
Using FtpCommand
Adding printer to the list of supported printers for the specified server
Enumerating Volumes and Volume Mounting Points (NTFS)
Get the power status of your laptop computer
Reading and setting system access privileges for the current process
Retrieving information about MS-DOS device names using QueryDosDevice (WinNT only)
The DetectAutoProxyUrl function identifies the auto-config script location
Using InternetGoOnline function
How to save registry key including its subkeys and values to a file
Reading the state of mouse buttons within DO WHILE loop
Retrieveing information about the active window (even if it is not owned by the calling process)
Displaying OS Memory Status

User rating: 8.5/10 (2 votes)
Rate this code sample:
  • ~
More code examples    Listed functions    Add comment     W32 Constants      Translate this page Printer friendly version of this code sample
Versions:
click to open
 
*|typedef struct _MEMORYSTATUS {  
*| DWORD dwLength;           0:4
*| DWORD dwMemoryLoad;       4:4
*| SIZE_T dwTotalPhys;       8:4
*| SIZE_T dwAvailPhys;      12:4
*| SIZE_T dwTotalPageFile;  16:4
*| SIZE_T dwAvailPageFile;  20:4
*| SIZE_T dwTotalVirtual;   24:4
*| SIZE_T dwAvailVirtual;   28:4
*| } MEMORYSTATUS, *LPMEMORYSTATUS; total 32 bytes
#DEFINE MEMORYSTATUS_SIZE  32
 
DECLARE GlobalMemoryStatus IN kernel32;
    STRING @lpBuffer
 
PRIVATE cBuffer
cBuffer = REPLI(Chr(0), MEMORYSTATUS_SIZE)
= GlobalMemoryStatus(@cBuffer)
 
= Writeln("Memory in use, % ...................",  5)
= Writeln("Physical memory, in bytes ..........",  9)
= Writeln("Physical memory available, bytes ...", 13)
= Writeln("Committed memory limit, bytes ......", 17)
= Writeln("Available memory to commit, bytes ..", 21)
= Writeln("User mode portion..., bytes ........", 25)
= Writeln("Unreserved/uncommitted memory ......", 29)
 
PROCEDURE Writeln(cCaption, nOffs)
    LOCAL nSize
    nSize = buf2dword(SUBSTR(cBuffer,nOffs,4))
    ? cCaption + " " + ALLTRIM(TRANS(nSize, "999,999,999,999,999,999"))
 
FUNCTION buf2dword(cBuffer)
RETURN Asc(SUBSTR(cBuffer, 1,1)) + ;
    BitLShift(Asc(SUBSTR(cBuffer, 2,1)),  8) +;
    BitLShift(Asc(SUBSTR(cBuffer, 3,1)), 16) +;
    BitLShift(Asc(SUBSTR(cBuffer, 4,1)), 24)
 
 
 

User rating: 8.5/10 (2 votes)
Rate this code sample:
  • ~
1310 bytes  
Created: 2001-07-12 12:00:00  
Modified: 2005-04-29 10:13:48  
Visits in 7 days: 97  
Listed functions:
GlobalMemoryStatus
Printer friendly API declarations
My comment:
MEMORYSTATUS reflects the state of memory at the time of the call. It reflects the size of the paging file at that time.

Memory in use -- for WinNT this value can be zero.

On computers with more than 4 GB of memory, the MEMORYSTATUS structure may return incorrect information. If your application is at risk for this behavior, use the GlobalMemoryStatusEx function instead.
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 (107.21.156.140)
15.5 min.Example: 'Class library providing access to the System Registry'
15.6 min.Example: 'Reading keys in the specified section of the Win.ini file'
1.09 hrs.Function: 'StrCmpC'
Function group: 'String'
 Example: 'Creating a window using CreateWindowEx function'
1.35 hrs.Function: 'DPtoLP'
Function group: 'Coordinate Space and Transformation'
 Example: 'How to put a vertical text scrolling on the form (a movie cast)'
 Example: 'GDI+: printing image file'
2.24 hrs.Function: 'DrawMenuBar'
Function group: 'Menu'
 Example: 'GDI+: Color Transparency'
 Example: 'How to display advanced Task Dialog (Vista)'
Google
Advertise here!