Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Comparing dimensions of the VFP main window with _SCREEN properties
Storing the environment strings in cursor
Using File Mapping for enumerating files opened by Visual FoxPro
Enumerating forms supported by a specified printer
How to delete file on FTP server
Retrieving file information for the VFP executable running
Using the RestartDialog function -- restarting Windows
Using GetNearestColor
Using the MessageBox Win32 function
Using Multimedia Command Strings to play MIDI files
DiskFreeSpace class
How to initiate System shutdown
Winsock: how to retrieve a service information corresponding to a service name
Enumerating ODBC drivers available on the local computer
Obtaining I/O counts for the current process
Obtaining the bounding rectangle for the specified device context
Using the GetLogicalDriveStrings
Displaying Windows shell folders in TreeView control with Visual FoxPro FLL
How to run FoxPro application under different user name (impersonating user)
Basic Volume information
Converting twips to pixels and vice versa
Disabling drawing in the VFP form
Reading and setting Environment variables
System and Local Time values
Comparing dimensions of the VFP main window with _SCREEN properties

User rating: 10/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 decl

* displays dimensions for the objects
DO _winRect      && main VFP window
DO _clientRect   && client part of the main VFP window
DO _screenRect   && _screen object

PROCEDURE _screenRect
    ? 
    ? "*** _SCREEN dimensions" 
    ? "    left:   " + STR(_screen.left,   6) 
    ? "    top:    " + STR(_screen.top,    6) 
    ? "    width:  " + STR(_screen.width,  6) 
    ? "    height: " + STR(_screen.height, 6) 

PROCEDURE _winRect
    lpRect = REPLI (Chr(0), 16) 
    = GetWindowRect (GetActiveWindow(), @lpRect) 

    lnWinLeft   = buf2dword(SUBSTR(lpRect,  1,4)) 
    lnWinTop    = buf2dword(SUBSTR(lpRect,  5,4)) 
    lnWinRight  = buf2dword(SUBSTR(lpRect,  9,4)) 
    lnWinBottom = buf2dword(SUBSTR(lpRect, 13,4)) 
    lnWinWidth  = lnWinRight - lnWinLeft + 1 
    lnWinHeight = lnWinBottom - lnWinTop + 1 

    ? "*** Main VFP window rectangle" 
    ? "    left:   " + STR(lnWinLeft,   6) 
    ? "    top:    " + STR(lnWinTop,    6) 
    ? "    right:  " + STR(lnWinRight,  6) 
    ? "    bottom: " + STR(lnWinBottom, 6) 
    ? "    width:  " + STR(lnWinWidth,  6) 
    ? "    height: " + STR(lnWinHeight, 6) 

PROCEDURE _clientRect
    lpRect = REPLI (Chr(0), 16) 
    = GetClientRect (GetActiveWindow(), @lpRect) 

    ?
    lnWinLeft   = buf2dword(SUBSTR(lpRect,  1,4)) 
    lnWinTop    = buf2dword(SUBSTR(lpRect,  5,4)) 
    lnWinRight  = buf2dword(SUBSTR(lpRect,  9,4)) 
    lnWinBottom = buf2dword(SUBSTR(lpRect, 13,4)) 
    lnWinWidth  = lnWinRight - lnWinLeft + 1 
    lnWinHeight = lnWinBottom - lnWinTop + 1 

    ? "*** Main VFP client window rectangle" 
    ? "    left:   " + STR(lnWinLeft,   6) 
    ? "    top:    " + STR(lnWinTop,    6) 
    ? "    right:  " + STR(lnWinRight,  6) 
    ? "    bottom: " + STR(lnWinBottom, 6) 
    ? "    width:  " + STR(lnWinWidth,  6) 
    ? "    height: " + STR(lnWinHeight, 6) 

PROCEDURE decl
    DECLARE INTEGER GetActiveWindow IN user32 
    DECLARE INTEGER GetWindowRect IN user32 INTEGER hwnd, STRING @lpRect 
    DECLARE INTEGER GetClientRect IN user32 INTEGER hwnd, STRING @lpRect 

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: 10/10 (1 votes)
Rate this code sample:
  • ~
2219 bytes  
Created: 2001-07-31 12:00:00  
Modified: 2015-01-23 19:28:49  
Visits in 7 days: 139  
Listed functions:
GetActiveWindow
GetClientRect
GetWindowRect
Printer friendly API declarations
My comment:
_SCREEN Width and Height are affected by the state of:
  • VFP System Menu (try RELEASE MENU _msysmenu)
  • VFP status bar (try SET STATUS BAR ON/OFF)
  • VFP toolbar: where it is docked, how many controls it contains
  • VFP Command Window: whether it is dockable or not
Change the state of these objects, and check how it affects the output of this code.
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-2018 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.39), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
Last Topics Visited (23.22.240.119)
4 sec.Example: 'Displaying hypertext links with the SysLink control (VFP9, Comctl32.dll)'
7 sec.Project
10 sec.
14 sec.Links
17 sec.Function: 'InternetGetLastResponseInfo'
Function group: 'Internet Functions (WinInet)'
20 sec.Articles
21 sec.Function: 'NetMessageBufferSend'
Function group: 'Network Management'
23 sec.Function: 'CeGetSpecialFolderPath'
Function group: 'Remote Application Programming (RAPI)'
26 sec.Solutions
29 sec.Example: 'How to start the screen saver and how to find whether the screen saver is active'
Google
Advertise here!