My window still looses focus
I'm working with a On-Screen Keybord, just like the one in Accessebility in XP. I've made a form with topMost set to true. Also I've used your code to prevent my "on-screen keyboard form" getting the focus. Problem is that even if my window does't take the focus, the application that has focus, looses it.
Here's some code:
<code>
Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click
'How do I set focus to application currently(before mouseclick) having focus?
SendKeys.Send("B")
End Sub
Private Sub Label2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label2.Click
'How do I set focus to application currently(before mouseclick) having focus?
SendKeys.Send("A")
End Sub
Private Const WM_MOUSEACTIVATE As Integer = &H21
Private Const MA_NOACTIVATE As Integer = 3
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
If m.Msg = WM_MOUSEACTIVATE Then 'We don't want to be activated
m.Result = New IntPtr(MA_NOACTIVATE)
Return
End If
MyBase.WndProc(m)
End Sub
</code>
Regards
Lars