






|
VB Mania |

|
Flash a Window |
|
Information: In this example, the program calls a private function of the windows Library "user32", Flashwindow, to make the window title flashes in the task bar. You can use it to notify the user for any specific changes that needs attention. |
|
Private Declare Function FlashWindow Lib "user32" (ByVal hWnd As Long, ByVal bInvert As Long) As Long
Private Sub cmdFlash_Click() FlashWindow Form1.hWnd, True End Sub |
|
Illustration:
|
|
What You Need?: 1. One Form: named Form1 2. One commandButton: named cmdFlash |
|
Code:
|
|
Explanation: CommandButton cmdFlash: calls the private function FlashWindow with its parameters: ¨ hWnd: which is a handle to the window to be flashed (form1 here) and ¨ bInvert: If this parameter is TRUE, the window is flashed from one state to the other. If it is FALSE, the window is returned to its original state (either active or inactive). |
|
Hint: You can use this function in chatting program so that if the user get a message it will flash the window. I think you are familiar with this if you used Yahoo!, MSN… messengers ;) |
|
VB-Pedia: · Form: a member of VB Library which is a window or dialog box that makes up part of an application's user interface. Properties used: ¨ Property hWnd As Long It returns a handle (from Microsoft Windows) to an object's window and is read-only.
· FlashWindow: a private function of the windows Library "user32". It flashes the specified window one time. It does not change the active state of the window. Parameters ¨ hWnd: A handle to the window to be flashed. The window can be either open or minimized. ¨ bInvert.: If this parameter is TRUE, the window is flashed from one state to the other. If it is FALSE, the window is returned to its original state (either active or inactive). When an application is minimized and this parameter is TRUE, the taskbar window button flashes active/inactive. If it is FALSE, the taskbar window button flashes inactive, meaning that it does not change colors. It flashes, as if it were being redrawn, but it does not provide the visual invert clue to the user.
|

|
Sponsored Links |