Using Win32 functions in Visual FoxPro Image Gallery
Window
..msdn
BringWindowToTop
CloseWindow
CreateWindow
CreateWindowEx
DestroyWindow
EndTask
FindWindow
FindWindowEx
GetAncestor
GetClientRect
GetDesktopWindow
GetForegroundWindow
GetGUIThreadInfo
GetParent
GetShellWindow
GetWindow
GetWindowInfo
GetWindowPlacement
GetWindowRect
GetWindowText
GetWindowTextLength
GetWindowThreadProcessId
InternalGetWindowText
IsChild
IsIconic
IsWindow
IsWindowVisible
IsZoomed
MoveWindow
RealGetWindowClass
SetForegroundWindow
SetLayeredWindowAttributes
SetParent
SetWindowPos
SetWindowText
ShowWindow
SwitchToThisWindow
Code examples:
Creating a console window for Visual FoxPro application
How to activate Windows Calculator
How to control Adobe Reader 9.0 (SDI mode) from VFP application
How to hot-track menu item selection in top-level form (requires VFP9)
Testing Transparent Menu Class with top-level form (requires VFP9)
SetForegroundWindow
    Add comment     W32 Constants      Translate this page
The SetForegroundWindow function puts the thread that created the specified window into the foreground and activates the window. Keyboard input is directed to the window, and various visual cues are changed for the user
Code examples:
How to control Adobe Reader 9.0 (SDI mode) from VFP application
Creating a console window for Visual FoxPro application
How to activate Windows Calculator
How to hot-track menu item selection in top-level form (requires VFP9)
Testing Transparent Menu Class with top-level form (requires VFP9)
Declaration:
BOOL SetForegroundWindow(
    HWND  hwnd     // handle of window to bring to foreground
   );
FoxPro declaration:
DECLARE INTEGER SetForegroundWindow IN user32 INTEGER hwnd
Parameters:
hwnd
Identifies the window that should be activated and brought to the foreground
Return value:
If the function succeeds, the return value is TRUE
Usage:
void MoveWindowToForeground( HWND hwnd )
{
    if ( !IsWindow(hwnd) ) return;
    if ( !IsWindowVisible(hwnd) ) return;

    if (IsZoomed(hwnd)) 
        ShowWindow( hwnd, SW_SHOW );
    else if (IsIconic(hwnd)) 
        ShowWindow( hwnd, SW_SHOWNORMAL );
    else 
        ShowWindow( hwnd, SW_SHOW );

    SetForegroundWindow(hwnd);
}
My comment:
MSDN: Starting with Windows 98, your application can no longer simply rely on calling SetForegroundWindow to get the foreground window. The system restricts which processes can set the foreground window.

See also the GetForegroundWindow function.

Visual FoxPro 9.0 introduces the AppState property, which indicates whether the Visual FoxPro application has focus or not. _SCREEN.AppState returns 0 or 1.

Using the BindEvent() function you can easily detect when your Visual FoxPro application loses or receives focus.

See also: SetFocus, GetFocus, GetForegroundWindow, GetActiveWindow.
Word Index links for the SetForegroundWindow :
Translate this page:
  Spanish    Portuguese    German    French    Italian  
FreeTranslation.com offers instant, free translations of text or web pages.
Created: 2001-07-12 12:00:00
Modified: 2011-03-28 10:08:10
Visited in last 7 days: 65
User Contributed Notes:
Peter Stordiau | 2001-10-01 09:33:30
In W2K there is a problem with activating the VFP Window at the moment the app started another task (i.e. RUN command implying a temporary Dos-box/task);

The Window receives the Activate-event, but it remains inactive and the Titlebar remains grey. User-input is not possible. One alt-tab or mouseclick on the Window activates the Window normally. A click in code won"t help, as well as all other creative ideas.

Even the SetForeGroundWindow won"t solve this problem.

So far this is determined as a W2K-problem.

At the moment a solution is found for this problem, I will put it here.

August 22, 2001.

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 (54.158.214.111)
13 sec.Function: 'sendto'
Function group: 'Windows Sockets 2 (Winsock)'
27 sec.Example: 'Displaying system dialog that selects a folder'
42 sec.
Function group: 'Service'
57 sec.Function: 'PageSetupDlg'
1.15 min.Function: 'RollbackTransaction'
1.37 min.Function: 'closesocket'
Function group: 'Windows Sockets 2 (Winsock)'
1.57 min.Function: 'GdipDrawRectangle'
1.77 min.Function: 'inet_addr'
Function group: 'Windows Sockets 2 (Winsock)'
2 min.
Function group: 'Monitor Configuration (Vista)'
2.23 min.Function: 'DeleteObject'
Google
Advertise here!