WM_SETFOCUS does not work

  • Thread starter Thread starter Sean
  • Start date Start date
S

Sean

Hi,

I have the following code on a NativeWindow subclass.
this.handle points to a window and the following code
is executed when a new window is initialized and shown,
hence making the window (this.handle) behind the new
window.

However, the window behind cannot get the focus with the
following code. Could someone please help me how to make
the window behind has the focus so that I can show the
caret?

SendMessage(this.Handle, WM_NCACTIVATE, 1, IntPtr.Zero);
SendMessage(this.Handle, WM_SETFOCUS, 1, IntPtr.Zero);
CreateCaret(this.Handle, IntPtr.Zero, 0, 0);
ShowCaret(this.Handle);

Thank you very much in advance.


regards,
Sean
 
Back
Top