Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
How to display picture stored in enhanced-format metafile (*.emf)
Uploading file to the FTP server using InternetWriteFile
Using the CreateFile
Listing INF files in a specified directory
Obtaining a handle to the desktop associated with the calling thread
Retrieving System Error message strings
Using Beep and Sleep functions to make the old tin buzz sing (WinNT only?)
GDI+: Using Scale and Shear transformations
How to empty the Recycle Bin
How to intercept window messages sent to VFP form
Retrieving list of Global Atom names
Converting path to original case
Enumerating files opened on the network
GDI+: cropping images
System Image List Viewer
Validating the heap of the calling process
Accessing examples contained in this reference from a VFP application
CryptoAPI: retrieving list of providers
How to hot-track menu item selection in top-level form (requires VFP9)
Number of clipboard formats available
Retrieving the state of your Internet connection
Using FrameRgn for displaying system colors
Using GetSysColor
Deleting a file stored on the FTP server
Minimizing all running applications

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
Before you begin:
It is almost the same if you would select the Minimize All Windows command from the Windows toolbar menu.
 
DO decl
LOCAL hWinActive, hWindow, lcWinText, hWinCount, lnWinIndex
hWinActive = GetActiveWindow()
hWindow = -1
hWinCount = 0
 
#DEFINE GW_HWNDFIRST  0
#DEFINE GW_HWNDLAST   1
#DEFINE GW_HWNDNEXT   2
 
DO WHILE hWindow <> GetWindow (hWinActive, GW_HWNDLAST)
    IF hWindow = -1
        hWindow = GetWindow(hWinActive, GW_HWNDFIRST)
    ELSE
        hWindow = GetWindow(hWindow, GW_HWNDNEXT)
    ENDIF
 
    IF IsWindow(hWindow) <> 0;
        And IsWindowVisible(hWindow) <> 0;
        And GetWindowTextLength(hWindow) > 0
 
        lcWinText = GetWinText(hWindow)
 
        * storing suitable window handles to an array
        IF Not "Program Manager" $ lcWinText
            hWinCount = hWinCount + 1
            DIMEN arrWin[hWinCount]
            arrWin[hWinCount] = hWindow
        ENDIF
    ENDIF
ENDDO
 
FOR lnWinIndex=1 TO hWinCount
    If IsIconic(arrWin[lnWinIndex]) = 0
        = CloseWindow(arrWin[lnWinIndex])
    ENDIF
ENDFOR
* end of main
 
FUNCTION  GetWinText(hWindow)
    LOCAL lnBufsize, lcBuffer
    lnBufsize = 1024
    lcBuffer = Repli(Chr(0), lnBufsize)
    lnBufsize = GetWindowText(hWindow, @lcBuffer, lnBufsize)
RETURN  Iif(lnBufsize=0, "", Left(lcBuffer,lnBufsize))
 
PROCEDURE  decl
    DECLARE INTEGER GetActiveWindow  IN user32
    DECLARE INTEGER GetWindow IN user32 INTEGER hwnd, INTEGER wFlag
    DECLARE INTEGER IsWindow IN user32 INTEGER hWnd
    DECLARE INTEGER IsWindowVisible IN user32 INTEGER hWnd
    DECLARE INTEGER GetWindowTextLength IN user32 INTEGER hWnd
 
    DECLARE INTEGER GetWindowText IN user32;
        INTEGER hwnd, STRING @lpString, INTEGER cch
 
    DECLARE INTEGER CloseWindow IN user32 INTEGER hWnd
    DECLARE INTEGER IsIconic IN user32 INTEGER hWnd
 
 
 

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
1614 bytes  
Created: 2002-01-10 18:25:51  
Modified: 2008-12-03 15:26:21  
Visits in 7 days: 80  
Listed functions:
CloseWindow
GetActiveWindow
GetWindow
GetWindowText
GetWindowTextLength
IsIconic
IsWindow
IsWindowVisible
Printer friendly API declarations
My comment:
The GetWindow is used to obtain handles to all windows siblings to the main VFP window, excluding the Program Manager window.

Then the CloseWindow is applied to every handle to minimize the window. This name is quite obscure, because the windows are in fact minimized not being closed by this function.

Compare with the DestroyWindow. This name gives a clear idea of what this function really does.

See also:
Microsoft Help and Support: How to re-create the Show Desktop icon on the Quick Launch bar
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 (23.22.212.158)
15.28 min.Example: 'Establishing connection using the SQLDriverConnect'
36.7 min.Example: 'Creating a mailslot'
36.75 min.Example: 'Using InternetGoOnline function'
5.36 hrs.Function: 'PeekMessage'
 Example: 'How to Start a Process as Another User (NT/XP/2K)'
8.81 hrs.Example: 'Obtaining names and positions for shortcuts located on the Windows Desktop'
9.86 hrs.Example: 'Using Font and Text functions'
 Function: 'PathBuildRoot'
Function group: 'Shell Lightweight Utility APIs -- Path Functions'
10.95 hrs.Function: 'DeleteFileTransacted'
 Function: 'GetDefaultPrinter'
Google
Advertise here!