PC Review


Reply
Thread Tools Rating: Thread Rating: 2 votes, 1.00 average.

Application lost focus

 
 
Peter Larsen [CPH]
Guest
Posts: n/a
 
      21st Sep 2009
Hi,

I'm using dotNet 3.5 winforms.

How do i detect when windows shift focus away from my application ??
I think it should be something similar to Application.OnLeave, but i can't
find it !


BR
Peter


 
Reply With Quote
 
 
 
 
Armin Zingler
Guest
Posts: n/a
 
      21st Sep 2009
Peter Larsen [CPH] schrieb:
> Hi,
>
> I'm using dotNet 3.5 winforms.
>
> How do i detect when windows shift focus away from my application ??
> I think it should be something similar to Application.OnLeave, but i can't
> find it !


http://msdn.microsoft.com/en-us/libr...8VS.85%29.aspx

First I wanted to suggest to add a message filter by calling
Application.AddMessageFilter. However, this method doesn't seem to
handle all messages. I do not yet know why. However, you can override
a Form's WndProc method and handle the message (WM_ACTIVATEAPP=0x1C).


--
Armin


 
Reply With Quote
 
Jie Wang [MSFT]
Guest
Posts: n/a
 
      21st Sep 2009
Hi Peter,

Are you looking for the Form.Deactivate event?

http://msdn.microsoft.com/en-us/libr...orm.deactivate
.aspx

This event occurs when the form loses focus and is no longer the active
form.

Best regards,
Jie Wang

Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(E-Mail Removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subs...#notifications.

Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business days is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subs.../aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

 
Reply With Quote
 
Peter Larsen [CPH]
Guest
Posts: n/a
 
      21st Sep 2009
Hi Jie,

Nope, not form deactivating, but application deactivating :-)
I think Armin got it right talking ablout "WM_ACTIVATEAPP".

BR
Peter


 
Reply With Quote
 
Peter Larsen [CPH]
Guest
Posts: n/a
 
      21st Sep 2009
Hi Armin,

Thank you for pointing me in the right direction.

BR
Peter


"Armin Zingler" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...

> First I wanted to suggest to add a message filter by calling
> Application.AddMessageFilter. However, this method doesn't seem to
> handle all messages. I do not yet know why. However, you can override
> a Form's WndProc method and handle the message (WM_ACTIVATEAPP=0x1C).
>



 
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Application Lost Focus when launch through Windows Explorer Asif Microsoft VB .NET 0 20th Feb 2007 12:08 PM
Application Lost Focus when launch through Windows Explorer Asif Microsoft Dot NET Framework Forms 0 20th Feb 2007 12:06 PM
Application lost focus =?Utf-8?B?Um9iIFM=?= Microsoft Dot NET Compact Framework 0 29th Apr 2005 04:00 PM
Focus lost from Word Application - VB.NET jg gs Microsoft VB .NET 0 4th Jan 2005 03:29 PM
Focus lost from Word Application - VB.NET jg gs Microsoft VB .NET 0 4th Jan 2005 03:14 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:38 PM.