|
Overview |
|
|
|
Group |
|
|
|
Quick Info
Windows NT
| Yes
| Win95
| Yes
| Win32s
| No
| Import Library
| user32.lib
| Header File
| winuser.h
| Unicode
| No
| Platform Notes
| None
|
|
|
SetForegroundWindow
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.
BOOL SetForegroundWindow(
HWND hWnd
| // handle of window to bring to foreground
| );
|
|
Parameters
hWnd
Identifies the window that should be activated and brought to the foreground.
Return Values
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error
information, call GetLastError.
Remarks
The foreground window is the window at the top of the Z order. It is the window that the user is working with. In a preemptive multitasking
environment, you should generally let the user control which window is the
foreground window. However, an application can call SetForegroundWindow if it wants to put itself into the foreground to display a critical error or
information that requires the user's immediate attention. A good example is a
debugger when it hits a breakpoint.
The system assigns a slightly higher priority to the thread that created the
foreground window than it does to other threads.
See Also
GetForegroundWindow
Comment from Greatis Sofware
If you're programming since 16-bit Windows systems age, then you might know that you can easily activate an application by calling
SetActiveWindow function with handle of window, that you need to bring to front. In 16-bit Windows there were only one active window and one input focus in whole system. And these statuses were simply exchanging between windows and application controls. The golden years... Then, 32-bit systems came out with their idea of threads full independence. Now, every thread has its own active window and input focus, and SetWindow function still makes window active... in its thread. It does not affect activity of thread itself, so, there's no any practical benefit in it. What's useful in the fact, that some window in the application, that is in bottom, becomes above others? It looks like Microsoft have noticed that, and created SetForegroundWindow function, which, luckely, works in 32-bit systems very similar to
SetActiveWindow in 16-bit. However, absolute happiness can't exist in Windows and SetForegroundWindow works undergraduate in Windows98 and
Windows2000. Fortunately, these systems become more and more rare.
| Last news from Greatis Software |
 |
|
Nostalgia .Net |
|
.Net is powerful, but not all-powerful, so sometimes we need to use Win32 API for our .Net applications. It's simple enough with Platform Invoke if you have Win32 skill, but we do not always have time to dig the ancient documentation, declare the special types that are compatible with Win32, find the values of the Win32's constants and so on. Nostalgia .Net offers several simple-to-use classes, and components that will allow you to forget about the headache of Win32 and just use the power of Win32 in your application the same way as you use the native. Net classes. More » |
| Recommended software for developers |
 |
|
Ultimate Pack |
|
Component pack for Delphi and C++ Builder that contains runtime form designer, runtime object inspector, print suite and much more for the very special price. More » |
 |
|
Form Designer .Net |
|
Unique runtime form design solution that allows to edit any form in .Net WinForms application at runtime with full source codes for only 300 euro! More » |
 |
|
Print Suite .Net |
|
Print Suite .Net is a set of components for easy printing texts, images and grids from your WinForms applications. Full C# source codes are available More » |
 |
|
Gradient Controls .Net |
|
Gradient Controls .Net offers controls with gradient background feature. Labels, panels and so on... Full C# source codes are available More » |
 |
|
Greatis iGrid |
|
iGrid plots drawing grid right over your desktop, so you can use it everywhere, with any drawing application without any special plugins for different graphic editors. More » |
All the contacts and projectsDmitry Vasiliev (just.dmitry)
Related LinksSoftware for Visual Studio .NET developers Software for Delphi and C++ Builder developers Software for Visual Basic 6 developers Delphi Tips&Tricks MegaDetailed.NET More Online Helps Win32 Programmer's Reference Win32 Multimedia Programmer's Reference OLE Programmer's Reference Microsoft Windows Pen API Programmer's Reference Microsoft Windows Sockets 2 Reference Microsoft Windows Telephony API (TAPI) Programmer's Reference Unix Manual Pages
|