Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
How to change display settings: screen resolution, screen refresh rate
Adding and deleting Scheduled Tasks using NetScheduleJob API functions
Custom GDI+ class
Converting Unicode data from the Clipboard to a character string using a given code page
Capturing keyboard activity of another application with the Raw Input API (VFP9)
Enumerating data formats currently available on the clipboard
Winsock: sending email messages (SMTP, port 25)
Custom FTP Class for Visual FoxPro application
Detecting changes in connections to removable drives (VFP9)
How to download a file from the FTP server using FtpGetFile
Enumerating raw input devices attached to the system (keyboard, mouse, human interface device)
How to activate Windows Calculator
Splash Screen for the VFP application
Custom HttpRequest class (WinHTTP)
Custom HttpRequest class (WinINet)
Using Font and Text functions
How to play AVI file on the _screen
Mapping and disconnecting network drives
Establishing connection using the SQLDriverConnect
How to convert a bitmap file to monochrome format (1 bpp)
Deleting files into the Recycle Bin
Displaying bitmap using the AlphaBlend function
How to display the Properties dialog box for a file (ShellExecuteEx)
Using EnumPrinters function to enumerate locally installed printers
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: 70  
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 (54.224.75.101)
4 sec.Example: 'Number of clipboard formats available'
6.6 min.Example: 'Winsock: how to retrieve a service information corresponding to a port'
6.67 min.Example: 'Placing an arbitrary rectangular area of main VFP window on the Clipboard'
1.05 hrs.Example: 'Using Video Capture: displaying on FoxPro form frames and previewing video obtained from a digital camera'
 
Function group: 'Device Context'
2.06 hrs.Function: 'WNetGetLastError'
Function group: 'Windows Networking'
 Function: 'waveInOpen'
2.4 hrs.Function: 'CryptGetKeyParam'
6.57 hrs.Example: 'Drawing Windows frame controls using the DrawFrameControl function'
 Function: 'MAPIFreeBuffer'
Google
Advertise here!