Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Simple Window Viewer
Converting command-line string to a set of Unicode argument strings (WinNT only)
OS version and revision
Using the CreateFile
Enumerating MIDI output devices
Finding out if the current user is the Guest account
How to empty the Recycle Bin
Using shared memory to exchange data between two FoxPro applications
Adding supplementary data to AVI files
GDI+: creating scaled copy of image file
GDI+: rotating images using matrix transformations
How to view icons stored in executable files (Icon Viewer) - II
Reading and setting the priority class values for the current process and thread
Retrieving list of Global Atom names
Retrieving various system metrics
Using FrameRgn for displaying system colors
Using GetSysColor
GDI+: reading and writing metadata in JPEG and TIFF files
Obtaining a handle to the desktop associated with the calling thread
Obtaining OS memory performance information
Retrieving list of supported paper names (for example, Letter or Legal) for a given printer
Using the DeleteFile
Clipping mouse cursor area
Extracting the name and extension parts of a path string
Running a regular FoxPro form while main VFP window is minimized

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:
This code changes a parent window for the given form to the Windows Desktop.
 
PUBLIC objForm
objForm = CreateObject("Tform")
objForm.Visible = .T.
 
DEFINE CLASS Tform As Form
AutoCenter=.T.
PROTECTED formstatus
 
PROCEDURE  Init
    THIS.formstatus = 0
 
PROCEDURE  Activate
    IF THIS.formstatus = 1
        RETURN
    ENDIF
 
    DECLARE INTEGER GetDesktopWindow IN user32
    DECLARE INTEGER GetFocus IN user32
    DECLARE INTEGER SetParent IN user32;
        INTEGER hWndChild, INTEGER hWndNewParent
 
    LOCAL hForm, hDesktop
    hDesktop = GetDesktopWindow()
    hForm = GetFocus()
 
    * if successfully changing the parent window for this form
    * then minimizing the main VFP window
 
    IF SetParent (hForm, hDesktop) <> 0
        THIS.formstatus = 1
        _SCREEN.WindowState = 1
    ENDIF
 
ENDDEFINE
 

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
706 bytes  
Created: 2002-01-10 19:57:05  
Modified: 2002-01-10 20:05:25  
Visits in 7 days: 79  
Listed functions:
GetDesktopWindow
GetFocus
SetParent
Printer friendly API declarations
My comment:
It makes the form less dependent on the main VFP window. Its icon even appears on the Windows toolbar.

As I can see some more adjustments should be done to the form through the SetWindowLong function, since it is not possible to put it on top when it is hidden by other windows.
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)
2.85 hrs.Example: 'Writing entries to custom Event Log'
 Function: 'WSAWaitForMultipleEvents'
Function group: 'Windows Sockets 2 (Winsock)'
3.22 hrs.Example: 'GetFocus returns a HWND value'
5.04 hrs.Example: 'Using the ChooseColor function'
Language: 'C#'
5.55 hrs.Example: 'Using SQLBrowseConnect to connect to a data source through a number of iterative calls (SQL Server)'
 Example: 'Listing child windows for the Windows desktop'
1 day(s)Example: 'FindText -- the hopeless and useless Common Dialog'
 Function: 'GdipDeleteMatrix'
 Example: 'How to make a VFP form fading out when released (GDI+ version)'
 Function: 'GetCursorPos'
Google
Advertise here!