Declare Function SetForegroundWindow Lib "user32.dll" (ByVal hwnd As Long) As Long
Platforms: Win 95/98, Win NT
SetForegroundWindow makes the specified window the current foreground window and gives it the focus. This function should only be used with windows which your program owns. Of course this function should be used with caution, since the user usually doesn't expect the foreground window to change unexpectedly. The function tells Windows to somehow draw the user's attention to the window, such as by flashing its icon in the taskbar. The function returns 1 if successful, or 0 if an error occured.
Example:
' Make the window Form1 the current foreground window. The operating
' system will somehow draw the user to the window.
Dim retval As Long ' return value
retval = SetForegroundWindow(Form1.hWnd) ' set Form1 as the foreground window
See Also: GetForegroundWindow, SetActiveWindow
Category: Windows
Go back to the alphabetical Function listing.
Go back to the Reference section index.
This page is copyright © 2000 Paul Kuliniewicz. Copyright Information.
Go back to the Windows API Guide home page.
E-mail: vbapi@vbapi.com Send Encrypted E-Mail
This page is at http://www.vbapi.com/ref/s/setforegroundwindow.html