Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Listing INF files in a specified directory
Opening access to the Microsoft Internet functions for the application
StrDup returns a pointer to the duplicate of a source VFP string
Using GetBinaryType (WinNT only) to determine the type of an executable file
Using the CopyFile
Converting path to original case
Converting strings between ANSI and OEM
GDI+: Using Scale and Shear transformations
Testing Transparent Menu Class with top-level form (requires VFP9)
Using the Semaphore object to allow only one instance of VFP application running
Displaying the main Dial-Up Networking dialog box
Enumerating ODBC drivers available on the local computer
Enumerating the subkeys of a user-specific key
One more way to retrieve environment strings
Using the GetLogicalDriveStrings
Finding parameters for the region specified
How to check whether the system is 32-bit or 64-bit
Retrieving graphic capabilities of default printer
Searching for the specified file using the SearchPath
Setting and retrieving the double-click time for the mouse
An alternative way of setting Form.Closable to False
Pocket PC: creating backup for the System Registry
Power capabilities of the system: battery, UPS, sleep and hibernation modes, processor throttling
Current directory of the application
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: 67  
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 (50.16.108.167)
33.63 min.Example: 'How to run FoxPro application under different user name (impersonating user)'
1.21 hrs.Function: 'DestroyMenu'
 Function: 'ToAscii'
 Example: 'Simulating DOEVENTS'
2.74 hrs.Example: 'Extensible Storage Engine class library'
Language: 'Visual FoxPro'
 Function: 'CeFindNextDatabaseEx'
Function group: 'Remote Application Programming (RAPI)'
 Example: 'How to find which fonts Windows uses for drawing captions, menus and message boxes'
2.84 hrs.Example: 'Retrieving long values associated with the class of the VFP window'
 Example: 'Using IsChild() for testing ThisForm.ShowWindow property'
 Function: 'CeWriteFile'
Google
Advertise here!