I'm creating an windows form application. I have to do some actions after some of keyboard shortcuts is pressed. I have this part :
Protected Overrides Function ProcessCmdKey(ByRef msg As Message, keyData As Keys) As Boolean
If keyData = Keys.Control & Keys.T Then
'Wait till mouse clicks one of application controls
'And get selected control information
Else
MyBase.ProcessCmdKey(msg, keyData)
End If
End Function
Also, after this keyboard keys combination is pressed I have to get a control which is selected by mouse click. I am not able to make an event on every main form control (well, even if it would be possible I believe it's a stupid choice).
One of solution I have is Me.ActiveControl but it can't focus on labels and some other controls which can't be focused. So it's perhaps not the right choice.
Another solution which I found is global hooks but I can't understood how to use it. I'm asking your help and advices. If you have sample of global hooks or better solution how to get mouse clicked control share it :) Any help is appreciated, feel free to write your opinion :)