Is there a way, without useing a Timer control (which I'm not the least familiar with) to continously flash a form's title?
Printable View
Is there a way, without useing a Timer control (which I'm not the least familiar with) to continously flash a form's title?
VB Code:
Option Explicit Private Declare Function FlashWindow Lib "user32" (ByVal hWnd As Long, ByVal bInvert As Long) As Long Private Sub Form_Load() Me.Timer1.Interval = 200 'Change this value according to requirements Me.Timer1.Enabled = True End Sub Private Sub timer1_timer() Dim nReturnValue As Long nReturnValue = FlashWindow(hWnd, True) End Sub
I would actually perfer not to use a Timer, but thank you very much. :)
If you don't want to use a Timer, then use FlashWindowExVB Code:
Private Const FLASHW_STOP = 0 'Stop flashing. The system restores the window to its original state. Private Const FLASHW_CAPTION = &H1 'Flash the window caption. Private Const FLASHW_TRAY = &H2 'Flash the taskbar button. Private Const FLASHW_ALL = (FLASHW_CAPTION Or FLASHW_TRAY) 'Flash both the window caption and taskbar button. This is equivalent to setting the FLASHW_CAPTION Or FLASHW_TRAY flags. Private Const FLASHW_TIMER = &H4 'Flash continuously, until the FLASHW_STOP flag is set. Private Const FLASHW_TIMERNOFG = &HC 'Flash continuously until the window comes to the foreground. Private Type FLASHWINFO cbSize As Long hwnd As Long dwFlags As Long uCount As Long dwTimeout As Long End Type Private Declare Function FlashWindowEx Lib "user32" (pfwi As FLASHWINFO) As Boolean Private Sub Form_Load() 'KPD-Team 1999 'URL: [url]http://www.allapi.net/[/url] 'E-Mail: [email][email protected][/email] Dim FlashInfo As FLASHWINFO 'Specifies the size of the structure. FlashInfo.cbSize = Len(FlashInfo) 'Specifies the flash status FlashInfo.dwFlags = FLASHW_ALL Or FLASHW_TIMER 'Specifies the rate, in milliseconds, at which the window will be flashed. If dwTimeout is zero, the function uses the default cursor blink rate. FlashInfo.dwTimeout = 0 'Handle to the window to be flashed. The window can be either opened or minimized. FlashInfo.hwnd = Me.hwnd 'Specifies the number of times to flash the window. FlashInfo.uCount = 0 FlashWindowEx FlashInfo End Sub Private Sub Form_Paint() Me.CurrentX = 0 Me.CurrentY = 0 End Sub
Thank you.
I like it. :)
It might get to be annoying, so at some point, you probably want to turn it off. :D
OK, slightly harder problem (well I say SLIGHTLY):
How would you get just teh TEXT of the title bar to flash, say from blue to white?
Thanks for your help,
James Booth
Here's a shorter version of the code
And no, FlashWindow doesn't have the capability to flash different colors of the title text.VB Code:
Private Type FLASHWINFO cbSize As Long hwnd As Long dwFlags As Long uCount As Long dwTimeout As Long End Type Private Declare Function FlashWindowEx Lib "user32" (pfwi As FLASHWINFO) As Boolean Private Const FLASHW_ALL = &H3 'Flash both the window caption and taskbar button. This is equivalent to setting the FLASHW_CAPTION Or FLASHW_TRAY flags. Private Const FLASHW_TIMER = &H4 'Flash continuously, until the FLASHW_STOP flag is set. Private Sub Form_Load() Dim FlashInfo As FLASHWINFO FlashInfo.cbSize = Len(FlashInfo) FlashInfo.dwFlags = FLASHW_ALL Or FLASHW_TIMER FlashInfo.hwnd = Me.hwnd FlashWindowEx FlashInfo End Sub