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
Capturing keyboard activity of another application with the Raw Input API (VFP9)
Converting Unicode data from the Clipboard to a character string using a given code page
Enumerating data formats currently available on the clipboard
Custom FTP Class for Visual FoxPro application
Winsock: sending email messages (SMTP, port 25)
Splash Screen for the VFP application
Detecting changes in connections to removable drives (VFP9)
How to download a file from the FTP server using FtpGetFile
How to activate Windows Calculator
Custom HttpRequest class (WinHTTP)
Establishing connection using the SQLDriverConnect
How to convert a bitmap file to monochrome format (1 bpp)
How to put a vertical text scrolling on the form (a movie cast)
Mapping and disconnecting network drives
Displaying bitmap using the AlphaBlend function
Using Font and Text functions
Enumerating raw input devices attached to the system (keyboard, mouse, human interface device)
Using WM_COPYDATA for interprocess communication (VFP9)
GDI+: copying to the Clipboard (a) image of active FoxPro window/form, (b) image file
Displaying animated images on FoxPro form with BitBlt and StretchBlt functions
How to play AVI file on the _screen
Listing child windows for the Windows desktop

User rating: 10/10 (1 votes)
Rate this code sample:
  • ~
More code examples    Listed functions    Add comment     W32 Constants      Translate this page Printer friendly version of this code sample
Versions:
click to open
 
#DEFINE GW_HWNDLAST 1
#DEFINE GW_HWNDNEXT 2
#DEFINE GW_CHILD 5
DO declare
 
CREATE CURSOR csResult (hWnd N(12), isvisible N(1),;
    leftpos I, toppos I, rightpos I, botpos I, wincap C(64), classname C(64))
 
LOCAL hDesktop, hFirstChild, hLastChild, rc, cWinCap, cWinClass,;
    nVisible, nLeft, nTop, nRight, nBottom
 
hDesktop = GetDesktopWindow()
hFirstChild = GetWindow(hDesktop, GW_CHILD)
hLastChild = GetWindow(hFirstChild, GW_HWNDLAST)
 
hCurrent = hFirstChild
DO WHILE .T.
    cWinCap = GetWinText(hCurrent)
    cWinClass= GetClsName(hCurrent)
    nVisible = IsWindowVisible(hCurrent)
 
    rc = Repli(Chr(0),16)
    = GetWindowRect(hCurrent, @rc)
    nLeft = buf2dword(SUBSTR(rc, 1,4))
    nTop = buf2dword(SUBSTR(rc, 5,4))
    nRight = buf2dword(SUBSTR(rc, 9,4))
    nBottom = buf2dword(SUBSTR(rc, 13,4))
 
    INSERT INTO csResult VALUES (hCurrent, nVisible,;
        nLeft, nTop, nRight, nBottom, cWinCap, cWinClass)
 
    IF hCurrent = hLastChild
        EXIT
    ENDIF
    hCurrent = GetWindow(hCurrent, GW_HWNDNEXT)
ENDDO
GO TOP
BROWSE NORMAL NOWAIT
* end of main
 
FUNCTION GetClsName(hWindow)
    LOCAL nBufsize, cBuffer
    cBuffer = Repli(Chr(0), 250)
    nBufsize = GetClassName(hWindow, @cBuffer, Len(cBuffer))
RETURN SUBSTR(cBuffer, 1, nBufsize)
 
FUNCTION GetWinText(hWindow)
* returns window title bar text -- Win9*/Me/XP/2000
    LOCAL cBuffer, nResult
    cBuffer = Space(250)
    nResult = GetWindowText(hWindow, @cBuffer, Len(cBuffer))
RETURN SUBSTR(cBuffer, 1, nResult)
 
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)
 
PROCEDURE declare
    DECLARE INTEGER GetDesktopWindow IN user32
    DECLARE INTEGER GetWindow IN user32 INTEGER hwnd, INTEGER wFlag
    DECLARE INTEGER GetWindowRect IN user32 INTEGER hwnd, STRING @lpRect
    DECLARE INTEGER IsWindowVisible IN user32 INTEGER hWnd
 
    DECLARE INTEGER GetWindowText IN user32;
        INTEGER hwnd, STRING @lpString, INTEGER cch
 
    DECLARE INTEGER GetClassName IN user32;
        INTEGER hWnd, STRING lpClassName, INTEGER nMaxCount
 
 
 

User rating: 10/10 (1 votes)
Rate this code sample:
  • ~
2148 bytes  
Created: 2001-07-12 12:00:00  
Modified: 2010-07-09 10:00:05  
Visits in 7 days: 112  
Listed functions:
GetClassName
GetDesktopWindow
GetWindow
GetWindowRect
GetWindowText
IsWindowVisible
Printer friendly API declarations
My comment:
In the resulting list you will probably find a window with a class name Shell_TrayWnd, which is Windows TaskBar. Using ShowWindow function it is possible to control its visibility.

C# code enumerates top-level windows on the screen by a single call to the EnumWindows.
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.76.170)
20.81 hrs.Example: 'FindText -- the hopeless and useless Common Dialog'
21.98 hrs.Function: 'GdipDeleteMatrix'
1 day(s)Example: 'How to make a VFP form fading out when released (GDI+ version)'
 Function: 'GetCursorPos'
 Example: 'Displaying all TCP connections for the local system'
 Function: 'htons'
2 day(s)Function: 'CopyIcon'
 Example: 'Using FoxTray ActiveX control: System Tray Icon and menu attached to VFP form'
 Example: 'Locking the workstation'
 Example: 'Saving available locale records into a cursor'
Google
Advertise here!