action without getiing the focus
-
Hi. I'm having trouble with setting the focus with WindowsForms. I'm trying to achieve the Windows OnScreenKeyBoard functionllity - achieving some action without getting the focus. I use the SendKeys.SendWait method to send keys to the window in focus, but in my case it is always the form containing the keyboard that is in focus:-) Can anyone give me a hint?
-
Hi. I'm having trouble with setting the focus with WindowsForms. I'm trying to achieve the Windows OnScreenKeyBoard functionllity - achieving some action without getting the focus. I use the SendKeys.SendWait method to send keys to the window in focus, but in my case it is always the form containing the keyboard that is in focus:-) Can anyone give me a hint?
SendKeys
class works only on the currently focused contorl. If you want to send keystrokes/Mouse clicks to a control, you have to get its handle and pass it to aSendMessage
API function call. You'd send a WM_KeyDown message I believe. Here is a link[^] on how to make a PInvoke call to the function. Ps. Sometimes -though rarely-, you'd have to send another WM_KeyUp message after the WM_KeyDown message.Regards:rose: