避免窗户变焦 [英] Avoid window getting focus

查看:129
本文介绍了避免窗户变焦的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用虚拟键盘,问题是当我按下虚拟键盘上的一个键,需要发送数据的窗口失去焦点。如何避免这种情况?

解决方案

当您的键盘格式接收到焦点时,收到的消息的一部分是窗口的句柄失去了焦点(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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆