user778654
user778654

Reputation:

Modal Window flicker effect

In a typical windows app, when a modal dialog appears and we click outside its boundaries it flickers thus indiacting that anything outside these boundaries is forbidden for now.

Is there any event that fires when this happens? I really need this effect so that I can mock this behavior for my WPF pseudo-modal window.

Thx. Harish

Upvotes: 2

Views: 693

Answers (1)

Simon Mourier
Simon Mourier

Reputation: 139075

See this SO question and the answer: Prevent WebBrowser control from stealing focus?

It explains what FlashWindow does in the background. I quote what's interesting for you:

Microsoft doesn't explain in so many words what FlashWindow does. Unfortunately, it doesn't send a specific message (say WM_FLASH or similar), which would've made it easier to capture and annul this behavior. Instead, FlashWindow does three things:

It sets a system timer for the flashing intervals It sends a WM_NCACTIVATE message for the first flash It sends a WM_NCACTIVATE message when the timer expires (on receiving WM_SYSTIMER)

So you'll have to find the window you're interested in, and try to catch WM_SYSTIMER in the hosting window procedure. It's a (very old) undocumented Windows message. Value is 0x118. You can also trap WM_NCACTIVATE which may be easier because it's represented by .NET events (Activated, Deactivate, etc...)

Upvotes: 1

Related Questions