Click to See Complete Forum and Search --> : Application losing focus


prl_pt
May 1st, 2007, 05:32 PM
Hello,

In my application, users can receive phone calls. The code managing this process is this:

public partial class IncomingCall : Form
{
public IncomingCall()
{
InitializeComponent();

SystemState _incomingCall = new SystemState(SystemProperty.PhoneIncomingCall);

_incomingCall.Changed += new ChangeEventHandler(_incomingCall_Changed);

}

void _incomingCall_Changed(object sender, ChangeEventArgs args)
{
// My code here..
}

}

The problem is that, when the phone call comes I see my code being executed but then my application loses context, and the OS incoming calls system comes to focus.. When I hang up my call, my application comes to focus again..

What can I do to not lose focus of my application? I tried to add the line "this.Focus();" to the my code, but it didn't work.

Thanks in advance,
Paulo

matthewsanford
May 2nd, 2007, 04:15 PM
I had a similar problem when I was using a splashscreen this.Activate() fixed it for me.