Windows API Guide: RegSetValueEx Function


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.

hwnd
A handle to the window to set as the foreground window.

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



Windows API Guide
Windows API Guide - Reference - Volume 1: Version 3.0 For the MS-DOS and PC-DOS Operating Systems
ISBN: B001V0KQIY
EAN: N/A
Year: 1998
Pages: 610

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net