Group: Window - Library: user32
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
How to activate Windows Calculator
Creating a console window for Visual FoxPro application
Testing Transparent Menu Class with top-level form (requires VFP9)
How to hot-track menu item selection in top-level form (requires VFP9)
How to control Adobe Reader 9.0 (SDI mode) from VFP application
BOOL SetForegroundWindow(
HWND hwnd // handle of window to bring to foreground
); DECLARE INTEGER SetForegroundWindow IN user32 INTEGER hwnd hwnd Identifies the window that should be activated and brought to the foreground
If the function succeeds, the return value is TRUE
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.
Home