Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
A procedure for setting file times
GDI+: creating scaled copy of image file
How to assemble an array of strings and pass it to external function
Printing text with the Escape function
Retrieving the name of the primary domain controller (PDC) and join status information (NT/2000/XP)
Wininet last error description
Creating a device context for the specified printer
DiskFreeSpace class
Enumerating files opened on the network
GetProcessVersion points at target OS
High-powered ALLTRIM
How to display the port-configuration dialog box for a port on the specified server
How to download this reference`s archive through WinInet functions using InternetOpenUrl
How to retrieve number of objects in the Recycle Bin
Obtaining I/O counts for the current process
Programmatically removing submenus from VFP main menu
Retrieving a universal form for the drive-based path for a network resource
Retrieving country-specific dialing information from the Windows Telephony list of countries
Using shared memory to exchange data between two FoxPro applications
Using the SetErrorMode for determining if a floppy drive is ready
Animating a transition of the VFP form (a wire-frame rectangle)
How to display a Task Dialog (Vista)
How to make the caption of a VFP application flashing in the Windows task bar
Monitoring changes in a directory
Comparing dimensions of the VFP main window with _SCREEN properties

User rating: 0/10 (0 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: 0/10 (0 votes)
Rate this code sample:
  • ~
2219 bytes  
Created: 2001-07-31 12:00:00  
Modified: 2004-06-07 09:18:51  
Visits in 7 days: 75  
Listed functions:
GetActiveWindow
GetClientRect
GetWindowRect
Printer friendly API declarations
My comment:
_SCREEN Width and Height properties depend on location of system menu (try RELEASE MENU _msysmenu), on status bar (try SET STATUS BAR ON/OFF). And of course, it depends on where system toolbar members placed.

Remove some or all objects :status bar, system menu, tool bars to 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-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.20.7.65)
3 sec.Example: 'Retrieving configuration information for the specified server (Win2000/XP)'
6.5 min.Function: 'GlobalFree'
6.55 min.Function: 'MessageBeep'
Function group: 'Error Handling'
33.05 min.Example: 'Retrieving Window Class information for the VFP window'
33.12 min.Function: 'SetKeyboardState'
52.43 min.Example: 'Obtaining names and positions for shortcuts located on the Windows Desktop'
52.48 min.Function: 'GetRgnBox'
Function group: 'Region'
52.53 min.Example: 'Creating a clipping region from the path selected into the device context of a form'
1.12 hrs.Example: 'How to check whether the system is 32-bit or 64-bit'
 Example: 'How to retrieve version information for the specified file'
Google
Advertise here!