WM_SETFOCUS does not work

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
 

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

Top