Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
How to retrieve version information for the specified file
Obtaining the bounding rectangle for the specified device context
Retrieving the priority class for the current process
Simple MAPI: how to resolve a name to unique address list entry
Using GetNearestColor
Winsock: how to retrieve the protocol information corresponding to a protocol number
Converting twips to pixels and vice versa
Starting a dialog box for connecting to network resources and passing input parameters
Closing Windows
Copying files as a transacted operation (Vista)
Reading data from INI files
Displaying the drive type value
Drawing a window caption using the DrawCaption routine
GDI+: converting image file to another graphics format
Simulating DOEVENTS
GDI+: converting text strings to images and saving in a graphics file
GDI+: Storing DLL icon resources in image files
Retrieving information about MS-DOS device names using QueryDosDevice (WinNT only)
Retrieving the IP-to-physical address mapping table
DiskFreeSpace class
How to generate UUID values
How to save registry key including its subkeys and values to a file
List of addresses in the AutoDial mapping database
Returning some basic information for the specified INF file
Scanning a hierarchy of child windows down from the Windows Desktop

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
 
LOCAL hParent, hWindow, cTitle, cRect
hParent = GetDesktopWindow()
hWindow = 0
 
CREATE CURSOR cs (winhandle I,;
    x0 I, y0 I, x1 I, y1 I, wintitle C(200))
 
DO WHILE .T.
    STORE REPLICATE(CHR(0),255) TO cClass, cTitle
    hWindow = FindWindowEx(hParent, hWindow,;
        Null, Null)
 
    IF hWindow = 0
    * 123=ERROR_INVALID_NAME
    * 127=ERROR_PROC_NOT_FOUND
        ? "Exit on error:", GetLastError()
        EXIT
    ELSE
        cTitle = GetWinText(hWindow)
        cRect = GetWinRect(hWindow)
        INSERT INTO cs VALUES (hWindow,;
            buf2dword(SUBSTR(cRect, 1,4)),;
            buf2dword(SUBSTR(cRect, 5,4)),;
            buf2dword(SUBSTR(cRect, 9,4)),;
            buf2dword(SUBSTR(cRect, 13,4)),;
            cTitle)
    ENDIF
ENDDO
 
SELECT cs
GO TOP
BROWSE NORMAL NOWAIT
* end of main
 
FUNCTION GetWinText(hWindow)
    LOCAL cBuffer
    cBuffer = REPLICATE(CHR(0), 255)
    = GetWindowText(hWindow, @cBuffer, LEN(cBuffer))
RETURN STRTRAN(cBuffer, CHR(0), "")
 
FUNCTION GetWinRect(hWindow)
    LOCAL cBuffer
    cBuffer = REPLICATE(CHR(0), 16)
    = GetWindowRect(hWindow, @cBuffer)
RETURN cBuffer
 
PROCEDURE decl
    DECLARE INTEGER GetLastError IN kernel32
    DECLARE INTEGER GetDesktopWindow IN user32
 
    DECLARE INTEGER FindWindowEx IN user32;
        INTEGER hwndParent, INTEGER hwndChildAfter,;
        STRING @lpszClass, STRING @lpszWindow
 
    DECLARE INTEGER GetWindowText IN user32;
        INTEGER hWnd, STRING @lpString, INTEGER nMaxCount
 
    DECLARE INTEGER GetWindowRect IN user32;
        INTEGER hWnd, STRING lpRect
 
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)
 
 
 

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
1681 bytes  
Created: 2001-07-16 12:00:00  
Modified: 2004-12-24 12:04:29  
Visits in 7 days: 91  
Listed functions:
FindWindowEx
GetDesktopWindow
GetLastError
GetWindowRect
GetWindowText
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 (107.20.129.212)
4 sec.Example: 'How to put a vertical text scrolling on the form (a movie cast)'
1.03 hrs.Function: 'CryptStringToBinary'
 Example: 'Disabling drawing in the VFP form'
8.15 hrs.Example: 'Using the LoadImage function to have a bitmap file loaded and displayed on VFP main window'
 Function: 'SQLConnect'
Function group: 'ODBC API'
9.66 hrs.Example: 'Joining local computer to a domain (XP/2000)'
11.29 hrs.Function: 'JetOpenTable'
12.34 hrs.Example: 'StrDup returns a pointer to the duplicate of a source VFP string'
12.35 hrs.Example: 'How to create transparent areas inside a form -- punching holes in the form'
13.12 hrs.Example: 'How to generate GUID values'
Google
Advertise here!