How can let the Form always Focused

  • Thread starter Thread starter steel
  • Start date Start date
S

steel

How can let the Form always Fucused, so it can recieve all the message.
I override the onlostFocus and add the Focus it again but it doesn't
works. it seems the form always try to give up its focus when there are
some controls in it.

thanks a lot in advance.
 
I don't think that the form is going to be very *useful* if you never
release focus. If you want to accept text entry into a Textbox, for
example, it has to have the focus. Maybe you should tell us why you're
trying to do this. There may be a more sensible way.

Paul T.
 
[DllImport("coredll",EntryPoint="GetCapture")]
private static extern IntPtr GetCapture();
[DllImport("coredll",EntryPoint="SetForegroundWindow")]
private static extern bool SetForegroundWindow(IntPtr hWnd);

protected override void OnDeactivate(EventArgs e) {

this.Capture = true;
IntPtr hwnd = GetCapture();
this.Capture = false;
SetForegroundWindow(hwnd);

base.OnDeactivate(e);
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top