Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Storing the environment strings in cursor
Using the GradientFill function
Validating the heap of the calling process
Winsock: changing the byte ordering
Determining if an Active Network Connection is Available
Enumerating Processes -- WinNT
Finding parameters for the region specified
How to intercept window messages sent to VFP form
Printing text on the main VFP window
Reading metrics for the currently selected font
Setting properties of the window: caption and user-defined value
Using an Event Object. Part A: running an application that creates an Event object
Wininet last error description
Drawing icons associated with the VFP main window
How to generate GUID values
How to hide your program from the Close Program dialog (Win9* only)
List of addresses in the AutoDial mapping database
Memory usage info for current VFP session (WinNT only)
Opening access to the Microsoft Internet functions for the application
Retrieving the names of all sections in an initialization file
How to print picture stored in enhanced-format metafile (*.emf)
Reading and setting explicit Application User Model ID for the current process (Win7)
Terminating all running applications from a VFP program
Using an Event Object. Part B: running an application responding to events
Finding parameters for the region specified

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
 
*| typedef struct _RGNDATA { 
*|     RGNDATAHEADER rdh; 
*|     char          Buffer[1]; 
*| } RGNDATA, *PRGNDATA; 
 
*| typedef struct _RGNDATAHEADER { 
*|     DWORD dwSize; 
*|     DWORD iType; 
*|     DWORD nCount; 
*|     DWORD nRgnSize; 
*|     RECT  rcBound; 
*| } RGNDATAHEADER, *PRGNDATAHEADER; 
 
*| typedef struct _RECT { 
*|   LONG left; 
*|   LONG top; 
*|   LONG right; 
*|   LONG bottom; 
*| } RECT, *PRECT; 
 
 
    * creating a region to test
    hRgn = CreateRectRgn (0, 0, 200, 100)
 
    dwCount = 200
    lpRgnData = Repli (Chr(0), dwCount)
 
    lnLength = GetRegionData (hRgn, dwCount, @lpRgnData)
    lpRgnData = LEFT (lpRgnData, lnLength)
 
    ? "Length of return buffer:", lnLength
    ?
 
    ? "*** RGNDATAHEADER Structure:"
    ? "dwSize:  ", buf2dword (SUBSTR(lpRgnData,  1,4))
    ? "iType:   ", buf2dword (SUBSTR(lpRgnData,  5,4))
    ? "nCount:  ", buf2dword (SUBSTR(lpRgnData,  9,4))
    ? "nRgnSize:", buf2dword (SUBSTR(lpRgnData, 13,4))
    ? "Rect:    ",;
        buf2dword (SUBSTR(lpRgnData, 17,4)),;
        buf2dword (SUBSTR(lpRgnData, 21,4)),;
        buf2dword (SUBSTR(lpRgnData, 25,4)),;
        buf2dword (SUBSTR(lpRgnData, 29,4))
 
    ?
    ? "*** RECT structures that make up the region"
    ? "Rect1:    ",;
        buf2dword (SUBSTR(lpRgnData, 33,4)),;
        buf2dword (SUBSTR(lpRgnData, 37,4)),;
        buf2dword (SUBSTR(lpRgnData, 41,4)),;
        buf2dword (SUBSTR(lpRgnData, 45,4))
 
    * there can be more RECT structures following
    * for a combination of regions
 
    ?
    ? "*** Region bounding rectangle:"
 
    lprc = SPACE(16)
    lnResult = GetRgnBox (hRgn, @lprc)
    ? "Type:", lnResult
    ? "Rectangle:    ",;
        buf2dword (SUBSTR(lprc,  1,4)),;
        buf2dword (SUBSTR(lprc,  5,4)),;
        buf2dword (SUBSTR(lprc,  9,4)),;
        buf2dword (SUBSTR(lprc, 13,4))
 
* end of main
 
 
FUNCTION  buf2dword (lcBuffer) 
RETURN; 
    Asc(SUBSTR(lcBuffer, 1,1)) + ; 
    Asc(SUBSTR(lcBuffer, 2,1)) * 256 +; 
    Asc(SUBSTR(lcBuffer, 3,1)) * 65536 +; 
    Asc(SUBSTR(lcBuffer, 4,1)) * 16777216 
 
PROCEDURE  decl
    DECLARE INTEGER GetLastError IN kernel32
 
    DECLARE INTEGER GetRegionData IN gdi32;
        INTEGER hRgn,;
        INTEGER dwCount,;
        STRING @ lpRgnData
 
    DECLARE INTEGER CreateRectRgn IN gdi32; 
        INTEGER nLeftRect,; 
        INTEGER nTopRect,; 
        INTEGER nRightRect,; 
        INTEGER nBottomRect 
 
    DECLARE INTEGER GetRgnBox IN gdi32;
        INTEGER hrgn,;
        STRING @ lprc
 
 

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
2356 bytes  
Created: 2001-08-27 12:00:00  
Modified: 2001-09-28 16:45:36  
Visits in 7 days: 91  
Listed functions:
CreateRectRgn
GetLastError
GetRegionData
GetRgnBox
Printer friendly API declarations
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 (72.44.48.122)
4 sec.Example: 'Using Font and Text functions'
1.05 hrs.Example: 'Creating irregularly shaped FoxPro form using transparency color key'
 Example: 'Displaying dimmed window behind VFP top-level form'
 Function: 'GetUserObjectInformation'
5.15 hrs.Example: 'GDI+ fun: roach-infested desktop'
 Example: 'How to retrieve network parameters for the local computer (including Host name, Domain name, and DNS Server)'
6.41 hrs.Example: 'Monitoring changes in a directory'
 Example: 'Monitoring changes occurring within a directory'
11.4 hrs.Function: 'mmioDescend'
Function group: 'Windows Multimedia'
12.01 hrs.Function: 'NetShareAdd'
Google
Advertise here!