|
-
Apr 26th, 2002, 08:32 AM
#1
Thread Starter
Hyperactive Member
Flashing A Window
Is there a way, without useing a Timer control (which I'm not the least familiar with) to continously flash a form's title?
-
Apr 26th, 2002, 08:38 AM
#2
Not NoteMe
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
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe
"I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
Have I helped you? Please Rate my posts. 
-
Apr 26th, 2002, 08:41 AM
#3
Thread Starter
Hyperactive Member
I would actually perfer not to use a Timer, but thank you very much.
-
Apr 26th, 2002, 08:43 AM
#4
If you don't want to use a Timer, then use FlashWindowEx
VB 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]
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
-
Apr 26th, 2002, 12:30 PM
#5
Thread Starter
Hyperactive Member
Thank you.
I like it.
-
Apr 28th, 2002, 08:59 AM
#6
It might get to be annoying, so at some point, you probably want to turn it off.
-
May 2nd, 2002, 03:44 PM
#7
Lively Member
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
Ich widerstehe allem - nur nicht der Versuchung
(I can resist anything but temptation)
-
May 2nd, 2002, 04:08 PM
#8
Here's a shorter version of the code
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
And no, FlashWindow doesn't have the capability to flash different colors of the title text.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|