Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Running a regular FoxPro form while main VFP window is minimized
Simulating DOEVENTS
Tracking mouse movement to detect when to start dragging
Using GetBinaryType (WinNT only) to determine the type of an executable file
Using the RestartDialog function -- restarting Windows
How to enumerate, add and delete shares on the local computer (WinNT/XP)
How to retrieve information about a cache entry (Internet Explorer)
Reading metrics for the currently selected font
Retrieving long values associated with the class of the VFP window
Testing an ODBC connection for supporting specific functionality
Using Shell for performing operations on files
Using the CreateFile
Winsock: retrieving information about available transport protocols
How to drag a Form not using its Titlebar or Caption
How to retrieve adapter information for the local computer (including MAC address)
Reading security permissions for NTFS files and folders
Simple Window Viewer
Starting external program from VFP and waiting for its termination
GetFileOwner - Get the owner of an NTFS file
How to assemble an array of strings and pass it to external function
Obtaining a handle to the desktop associated with the calling thread
Retrieving Printer Device Context using PrintDlg function
Retrieving statistics for the TCP protocol running on the local computer
Using the ChooseColor function
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.

PROTECTED formstatus

    THIS.formstatus = 0

    IF THIS.formstatus = 1

    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


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: 83  
Listed functions:
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 offers instant, free translations of text or web pages.
User Contributed Notes:
There are no notes on this subject.

Copyright 2001-2017 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.6.38), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
Last Topics Visited (
3 sec.
5 sec.Function: 'SQLConfigDataSource'
Function group: 'ODBC API'
7 sec.
9 sec.Banners
11 sec.Function: 'mmioOpen'
Function group: 'Windows Multimedia'
12 sec.Articles
14 sec.Function: 'mmioFlush'
Function group: 'Windows Multimedia'
16 sec.Updates
17 sec.Function: 'CryptGetProvParam'
Function group: 'Cryptography Reference'
21 sec.Function: 'AVIFileRelease'
Function group: 'Windows Multimedia'
Advertise here!