PC Review Forums Newsgroups Microsoft DotNet Microsoft Dot NET Framework Forms How do I stop FlashWindowEx when me.handle gets focus?

Reply

How do I stop FlashWindowEx when me.handle gets focus?

 
Thread Tools Rate Thread
Old 12-01-2007, 01:50 PM   #1
Marc Miller
Guest
 
Posts: n/a
Default How do I stop FlashWindowEx when me.handle gets focus?


Hi....

I'm using FlashWindowEx to flash the taskbar and titlebar when my processes
are done.
I set the number of flashes to 5. But when the user returns to the window
the flashing
continues until all 5 flashes complete.

How do you stop the flashing once the user returns to the app.? (Code
Below)

Thanks for any help,
Marc Miller

Public Structure FLASHWINFO
Public cbSize As Int32
Public hwnd As IntPtr
Public dwFlags As Int32
Public uCount As Int32
Public dwTimeout As Int32
End Structure

Private Declare Function FlashWindowEx Lib "user32.dll" (ByRef pfwi As
FLASHWINFO) As Int32

Private Const FLASHW_CAPTION As Int32 = &H1
Private Const FLASHW_TRAY As Int32 = &H2
Private Const FLASHW_ALL As Int32 = (FLASHW_CAPTION Or FLASHW_TRAY)


Public Sub FlashNow(ByVal sender As System.Object, ByVal e As
System.EventArgs, ByVal iTimes As Integer)

Dim flash As New FLASHWINFO
flash.cbSize = System.Runtime.InteropServices.Marshal.SizeOf(flash)
'/// size of structure in bytes
flash.hwnd = Me.Handle '/// Handle to the window to be flashed
flash.dwFlags = FLASHW_ALL '/// to flash both the caption bar + the
tray
flash.uCount = iTimes '/// the number of flashes
flash.dwTimeout = 1000 '/// speed of flashes in MilliSeconds ( can
be left out )
'/// flash the window you have specified the handle for...
FlashWindowEx(flash)

End Sub


  Reply With Quote
Old 15-01-2007, 12:34 AM   #2
Bryan Phillips
Guest
 
Posts: n/a
Default Re: How do I stop FlashWindowEx when me.handle gets focus?

Call FlashWindowEx again using FLASHW_STOP as the value for dwFlags.

Here is a declaration for FLASHW_STOP:

Private Const FLASHW_STOP As Int32 = &H0

--
Bryan Phillips
MCSD, MCDBA, MCSE
Blog: http://bphillips76.spaces.live.com



"Marc Miller" <ctefsd_sys@hotmail.com> wrote in message
news:#FmOQClNHHA.3944@TK2MSFTNGP06.phx.gbl:

> Hi....
>
> I'm using FlashWindowEx to flash the taskbar and titlebar when my processes
> are done.
> I set the number of flashes to 5. But when the user returns to the window
> the flashing
> continues until all 5 flashes complete.
>
> How do you stop the flashing once the user returns to the app.? (Code
> Below)
>
> Thanks for any help,
> Marc Miller
>
> Public Structure FLASHWINFO
> Public cbSize As Int32
> Public hwnd As IntPtr
> Public dwFlags As Int32
> Public uCount As Int32
> Public dwTimeout As Int32
> End Structure
>
> Private Declare Function FlashWindowEx Lib "user32.dll" (ByRef pfwi As
> FLASHWINFO) As Int32
>
> Private Const FLASHW_CAPTION As Int32 = &H1
> Private Const FLASHW_TRAY As Int32 = &H2
> Private Const FLASHW_ALL As Int32 = (FLASHW_CAPTION Or FLASHW_TRAY)
>
>
> Public Sub FlashNow(ByVal sender As System.Object, ByVal e As
> System.EventArgs, ByVal iTimes As Integer)
>
> Dim flash As New FLASHWINFO
> flash.cbSize = System.Runtime.InteropServices.Marshal.SizeOf(flash)
> '/// size of structure in bytes
> flash.hwnd = Me.Handle '/// Handle to the window to be flashed
> flash.dwFlags = FLASHW_ALL '/// to flash both the caption bar + the
> tray
> flash.uCount = iTimes '/// the number of flashes
> flash.dwTimeout = 1000 '/// speed of flashes in MilliSeconds ( can
> be left out )
> '/// flash the window you have specified the handle for...
> FlashWindowEx(flash)
>
> End Sub


  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off