Suppose i have a button's handle and i want to make it or it's borders flash so the user can see it - how is it possible to do that ?
Posted on 2001-04-24 09:50:00 by lsx
There are two ways, I haven't tried the first, but it's worth a try:- 1)

invoke FlashWindow,hWnd,1
invoke FlashWindow,hWnd,0
invoke FlashWindow,hWnd,1
invoke FlashWindow,hWnd,0
The manual says it flashed the caption bar, but it might work. 2) This is slightly harder, but basically:-

invoke GetStockObject,BLACK_BRUSH
mov    hBlackBrush,eax
invoke GetStockObject,WHITE_BRUSH
mov    hWhiteBrush,eax
invoke GetWindowRect,hWnd,ADDR rc
invoke FrameRect,hWnd,ADDR rc,hBlackBrush
invoke Sleep,100
invoke FrameRect,hWnd,ADDR rc,hWhiteBrush
invoke Sleep,100
invoke FrameRect,hWnd,ADDR rc,hBlackBrush
invoke Sleep,100
invoke FrameRect,hWnd,ADDR rc,hWhiteBrush
invoke Sleep,100
invoke InvalidateRect,hWnd,0,1
Should Draw box around the button, in differing colours, then re-draw it again. umbongo
Posted on 2001-04-24 10:32:00 by umbongo
Doesn't FlashWindow keep on flashing the window until you invoke it again with a 0 for the bInvert param? From my experiments some time ago, and from the info in MSDN, I suppose it does. So, there should be no need to call it four times - invoke it once with bInvert set to 1, and when you get focus again, invoke it once more, but with bInvert set to 0.
Posted on 2001-04-25 05:22:00 by f0dder
Doesn't FlashWindow keep on flashing the window until you invoke it again with a 0 for the bInvert param?
I didn't think so, the documentation isn't that clear (no suprise there then) but it seems to be saying that it will flash it once, so I guess you're almost right, what I should have is:-
#
invoke FlashWindow,hWnd,1
invoke FlashWindow,hWnd,1
invoke FlashWindow,hWnd,1
invoke FlashWindow,hWnd,0
so it would flash the window 3 times, then return it to its original state. It' won't keep flashing until you tell it to stop, it just flashes it once. umbongo
Posted on 2001-04-25 09:22:00 by umbongo
....a couple of thoughts. 1)
Flashing a window means changing the appearance of its caption bar as if the window were changing from inactive to active status, or vice versa. (An inactive caption bar changes to an active caption bar; an active caption bar changes to an inactive caption bar.)
Umbongo's second example would work, although I haven't tried it. 2) As for the bInvert param... According to the sdk, "the FlashWindow function flashes the specified window once."
bInvert Specifies whether the window is to be flashed or returned to its original state. The window is flashed from one state to the other if this parameter is TRUE. If it is FALSE, the window is returned to its original state (either active or inactive).
Would there be a reason to use "invoke FlashWindow,hWnd,0" in this example? For that matter, when would you ever need to use a value of FALSE for bInvert?
Posted on 2001-04-25 10:18:00 by 4oh4
Well, like I say I haven't tried it, I guess if it flashes it once i.e. inverting then uninverting, you would not need the last one. It does beg the question what's the point of the parameter if 1 flashes the window and 0 doesn't do anything..... umbongo
Posted on 2001-04-25 10:51:00 by umbongo
Seems a bit queer, doesn't it? But I guess that's sort of usual with M$. We'll just have to try the stuff and see what matters. After re-reading MSDN, I can see that microsoft recommends setting up a timer if you want repeated flashes...
Posted on 2001-04-26 10:32:00 by f0dder