C# MDI Child form textbox Ctrl+C not working

power98888
power98888 used Ask the Experts™
on
Hi,

I have a MDI and a child form.  On the child form, the Ctrl+C not working.
I search lots of solution and find the one on MSDN but not really working.

I put this code in the MDI code but no help, the send message does capture something but
SendMessage may send wrong parameter whatever, no idea how to make it work
I need Ctrl + c, Ctrl + V + Ctrl +x work on the text box in the child form.

Please help.


//I put this code in the MDI code but no help, the send message does capture something but
//SendMessage may send wrong parameter whatever, no idea how to make it work
 
        [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)]
        static extern IntPtr SendMessage(IntPtr hWnd, Int32 Msg, IntPtr wParam, IntPtr lParam);
 
 
        protected override bool ProcessCmdKey(ref Message message, Keys keydata)
        {
            SendMessage(this.ActiveMdiChild.Handle, message.Msg, message.WParam, message.LParam);
            return base.ProcessCmdKey(ref message, keydata);
        }

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
this code may be able to help you, i hope....
const int WM_KEYDOWN = 0x0100; 
public override bool PreProcessMessage(ref Message msg) 
{ 
if(msg.Msg == WM_KEYDOWN && (Keys)msg.WParam.ToInt32() == Keys.C && ModifierKeys == Keys.Control) 
{ 
//add whatever you want here, this is after you have caught the ctrl + c
} 
return base.PreProcessMessage(ref msg); 
} 

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial