Avoid window getting focus

后端 未结 4 1563
忘了有多久
忘了有多久 2021-01-02 13:25

I am working on a virtual keyboard the problem is when i press a key on the virtual keyboard the window witch the data needs to be sent loses focus. How can i avoid that ?

4条回答
  •  心在旅途
    2021-01-02 14:17

    The only method I've seen to do what you want is to disable the window with the virtual keyboard EnableWindow(hWnd, FALSE).

    Now, if the window is disabled you will not get mouse messages, right? You have to options:

    • The easy one: Use WM_SETCURSOR. It is sent even to disabled windows, and in the high-order word of lParam you have the identifier of the original message (WM_LBUTTONDOWN, etc.). The coordinates of the cursor can be read using GetMessagePos().
    • The cool one: Use a windows hook: SetWindowsHookEx(WH_MOUSE, ...). You'll have full control of your mouse messages.

提交回复
热议问题