RichTextBox code to change the Insert/Overwrite mode does not work

D

**Developer**

I have a RichTextBox and I want to programmatically change the
Insert/Overwrite mode.

I tried the following but it doesn't appear to change the mode.

Pressing the Insert or Ins key does change the mode.



Any suggestions or verification?

Thanks





[DllImport("user32", CharSet=CharSet.Auto,EntryPoint="SendMessage")] public
static extern uint SendMessagezz (IntPtr hWnd , uint msg ,uint wParam , uint
lParam );

[DllImport("user32", CharSet=CharSet.Auto)] public static extern uint
MapVirtualKey (uint uCode , uint uMapType );

public static void FlipInsert(IntPtr Handle)

{

// uint WM_KEYDOWN = 0x100;

// uint WM_KEYUP = 0x101;

// uint VK_INSERT = 0x2D;

uint zz0 = MapVirtualKey(VK_INSERT, 0) * 0x10000;

uint zz1 = 1 | zz0;

uint zz2 = 0xC0000001 | zz0;

SendMessagezz(Handle, WM_KEYDOWN, VK_INSERT, zz1);

SendMessagezz(Handle, WM_KEYUP, VK_INSERT, zz2);

}
 

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