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 ?
There are two ways, I haven't tried the first, but it's worth a try:- 1)
The manual says it flashed the caption bar, but it might work. 2) This is slightly harder, but basically:-
invoke FlashWindow,hWnd,1 invoke FlashWindow,hWnd,0 invoke FlashWindow,hWnd,1 invoke FlashWindow,hWnd,0
Should Draw box around the button, in differing colours, then re-draw it again. umbongo
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
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.
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:-
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
# invoke FlashWindow,hWnd,1 invoke FlashWindow,hWnd,1 invoke FlashWindow,hWnd,1 invoke FlashWindow,hWnd,0
....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?
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
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...