Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
How to initiate System shutdown
Retrieving graphic capabilities of your display
Retrieving information specific to the current Time Zone
Setting properties of the window: caption and user-defined value
Using GetNearestColor
GDI+: Color Transparency
GDI+: rotating images using matrix transformations
Retrieving information about MS-DOS device names using QueryDosDevice (WinNT only)
DiskFreeSpace class
GetProcessVersion points at target OS
Reading data from INI files
Retrieving window and menu help context identifiers
Using an Event Object. Part B: running an application responding to events
Converting twips to pixels and vice versa
Drawing a window caption using the DrawCaption routine
GDI+: converting text strings to images and saving in a graphics file
GDI+: Using Scale and Shear transformations
How to hide your program from the Close Program dialog (Win9* only)
How to retrieve version information for the specified file
Retrieving configuration information for the specified server (Win98/Me)
Using Multimedia Command Strings to play MIDI files
Copying files as a transacted operation (Vista)
GDI+: Storing DLL icon resources in image files
Simulating DOEVENTS
The window and its ancestors

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:
Call this code in three different ways to compare the results: (a) from the Command window; (b) from an open PRG editor; (c) from a form method.
 
DO decl
 
#DEFINE GA_PARENT     1
#DEFINE GA_ROOT       2
#DEFINE GA_ROOTOWNER  3
 
LOCAL hWindow
hWindow = GetFocus()
 
ACTI SCREEN
? "*** The window and its ancestors"
 
= _print ("Source window:", hWindow)
= _print ("Parent window (GetParent):", GetParent (hWindow))
= _print ("Parent window (GetAncestor):", GetAncestor (hWindow, GA_PARENT))
= _print ("Root window:", GetAncestor (hWindow, GA_ROOT))
= _print ("Owned root window:", GetAncestor (hWindow, GA_ROOTOWNER))
 
ACTI SCREEN
?
? "*** Some other important windows"
 
= _print ("VFP main window:", GetActiveWindow())
= _print ("Windows desktop:", GetDesktopWindow())
 
PROCEDURE  _print (lcMemo, hWindow)
    LOCAL lcWintext
    lcWintext = GetWinText(hWindow)
    ACTI SCREEN
    ? lcMemo, "|", hWindow, "|", lcWintext
 
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 GetDesktopWindow IN user32
    DECLARE INTEGER GetActiveWindow IN user32
    DECLARE INTEGER GetFocus IN user32
 
    DECLARE INTEGER GetParent IN user32 INTEGER hwnd
    DECLARE INTEGER GetAncestor IN user32;
        INTEGER hwnd, INTEGER gaFlags
 
    DECLARE INTEGER GetWindowText IN user32;
        INTEGER hwnd, STRING @lpString, INTEGER cch
 
 

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
1388 bytes  
Created: 2002-01-25 20:55:32  
Modified: 2002-01-25 20:57:35  
Visits in 7 days: 116  
Listed functions:
GetActiveWindow
GetAncestor
GetDesktopWindow
GetFocus
GetParent
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)
1.62 hrs.Example: 'Testing serial ports'
5.59 hrs.Example: 'Using an Event Object. Part B: running an application responding to events'
 Function: 'MAPIAddress'
Function group: 'Simple MAPI'
 Function: 'midiOutGetDevCaps'
Function group: 'Windows Multimedia'
16.37 hrs.Example: 'Using the DrawText function'
 Function: 'CryptHashData'
Function group: 'Cryptography Reference'
16.7 hrs.Example: 'An alternative way of setting Form.Closable to False'
19.71 hrs.Example: 'Storing content of the Clipboard to a bitmap file'
19.72 hrs.Example: 'How to extract frames from AVI files'
1 day(s)Example: 'Confining Windows calculator inside the VFP main window'
Google
Advertise here!