避免窗户变焦 [英] Avoid window getting focus
问题描述
当您的键盘格式接收到焦点时,收到的消息的一部分是窗口的句柄失去了焦点(wParam)。做你需要做的事情,并把重点放在失去焦点的窗口上。
编辑:参见 WM_SETFOCUS
编辑2:
此外,您可以在创建自定义表单时使用以下内容:
程序TMainForm.CreateParams(var Params:TCreateParams);
// const WS_EX_NOACTIVATE = $ 8000000;
开始
继承;
Params.ExStyle:= Params.ExStyle + WS_EX_NOACTIVATE;
结束
为了防止您的表单激活(从另一种形式的焦点)。就像我在评论中暗示的那样,你应该可以使用非窗口的按键来控制。
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 ?
When your keyboard form receives focus, part of the message it receives is the handle of the window that lost focus (wParam). Do what you need to do and set the focus back to the window that lost focus.
EDIT: See the documentation on WM_SETFOCUS
EDIT 2:
Also, you could use the following when creating your custom form:
procedure TMainForm.CreateParams(var Params: TCreateParams) ;
//const WS_EX_NOACTIVATE = $8000000;
begin
inherited;
Params.ExStyle := Params.ExStyle + WS_EX_NOACTIVATE;
end;
To prevent your form from activating (taking focus from the other form). Like I alluded to in my comment, you should probably be using non-windowed controls for keys.
这篇关于避免窗户变焦的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!