Protected Overloads Overrides Function ProcessCmdKey(ByRef msg As Message, ByVal keyData As Keys) As Boolean If keyData = DirectCast(Shortcut.CtrlV, Keys) Then Me.ClearSelection() Dim text As String = Clipboard.GetText() ' SendKeys.Send(text); For k As Integer = 0 To text.Length - 1 ' Can not use SendKeys.Send SendCharKey(text(k)) Next Return True ElseIf keyData = DirectCast(Shortcut.CtrlC, Keys) Then Clipboard.SetText(Me.SelectedText) Return True End If Return MyBase.ProcessCmdKey(msg, keyData) End Function
Private Sub SendCharKey(ByVal pChar As Char) Dim msg As New Message() msg.HWnd = Me.Handle msg.Msg = WM_CHAR ' It has something wrong cannot convert to IntPtr ' Can i convert or make other away msg.WParam = pChar 'DirectCast(pChar, IntPtr) msg.LParam = IntPtr.Zero MyBase.WndProc(msg) End Sub
Private Sub SendCharKey(ByVal pChar As Char) Dim msg As New Message() msg.HWnd = Me.Handle msg.Msg = WM_CHAR ' msg.WParam = CType(pChar, IntPtr) msg.LParam = IntPtr.Zero MyBase.WndProc(msg) End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)