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);
}
 
Back
Top