全局鼠标左键单击事件在c ++中 [英] global mouse left click event in c++

查看:87
本文介绍了全局鼠标左键单击事件在c ++中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





i有一个文本框,实现为一个窗口,当双击窗口使文本框可编辑时,我需要它来保存更改文本框,如果我单击OUTSIDE文本框(基本上是包含文本框的窗口)。



这个包含文本框的窗口实现为模态窗口。如果我在可编辑窗口外面点击,它会发出哔哔声,好像不想放松注意力,因此我实现了它背后的窗口的鼠标点击事件代码不会被触发。



该怎么办?



我被建议使用一个全球鼠标点击事件并捕获鼠标左键单击的x,y将它与文本框窗口的边界进行比较。



我如何实现这个全球鼠标点击事件?



急切地等待支持性答案。

Hi,

i have a text box which is implemented as a window, when double clicked the window makes the text box editable, and I need it to save the changes of the text box, if I click OUTSIDE the textbox( basically the window that contains the text box).

this window containing textbox is implemented as modal window. If I click outside the editable window, it beeps, as if does not want to loose attention, and hence the mouse click event code which I had implemented the window behind it, does not get triggerred.

what to do?

I have been suggested to use a gloabl mouse click event and to capture x,y of the mouse left click and compare it with the boundaries of the textbox window.

how do I implement this global mouse click event?

waiting eagerly for the supportive answers.

推荐答案

当文本框失去焦点时,你可以调用你的保存代码。



查找窗口消息WM_KILLFOCUS
You could call your "save" code when the text box loses focus.

Look up the window message WM_KILLFOCUS


这篇关于全局鼠标左键单击事件在c ++中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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