I could not find another solution than using P / Invoke for this.
If this does not fit the pattern, there may be an alternative trivial way.
: keydown. KeyDown , "" WindowProc.
: , keydown. - , PostMessage.
dll:
Imports System.Runtime.InteropServices
<DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _
Private Shared Function PostMessage(ByVal hWnd As IntPtr, ByVal Msg As UInteger, ByVal wParam As IntPtr, ByVal lParam As IntPtr) As Boolean
End Function
ProcessCmdKey UserControl:
Protected Overrides Function ProcessCmdKey(ByRef msg As Message, ByVal keyData As Keys) As Boolean
'If ALT has been pressed...
If (keyData And Keys.Alt) > 0 Then
'... if another key is pressed aswell...
If (keyData Xor Keys.Alt) > 64 Then
'...pass the information to the container to see if it is interested
PostMessage(Me.ParentForm.Handle, CType(msg.Msg, UInt32), msg.WParam, msg.LParam)
Return True
End If
End If
'Not a key we are interested in
Return MyBase.ProcessCmdKey(msg, keyData)
End Function
/ P/Invoke, , .
, PostMessage :
Me.ParentForm.Controls(0).Focus()
, , ALT/key.