一个关于CWnd的问题,急!!!高手快来帮忙啊!!在线等待
定义两个CWnd的对象A,B。将其Create()出来,将A与B部分重叠,A在B上面,当点击A与B的重叠部分时,为何是B而不是A响应鼠标点击???
如何让A响应鼠标点击???
问题点数:100、回复次数:8Top
1 楼liuhongyong(荒原困兽)回复于 2003-02-04 16:48:38 得分 25
你点击鼠标的时候,产生的消息只能是当前线程的窗口处理。
在系统中,每次只能有一个线程和虚拟输入线程“连接”,这个线程的窗口这时就处于激活状态。
要想让A窗口响应鼠标消息,你就应该使A窗口激活。可以用SetFocus()啊。Top
2 楼eEric(Paranoia)回复于 2003-02-04 16:53:08 得分 0
用过SetActiveWindow()了,不行啊!Top
3 楼gull1234(俗不可耐)回复于 2003-02-04 19:01:16 得分 25
不是用SetActiveWindow()。而是用SetFocus()
(from MSDN)
The SetFocus member function sends aWM_KILLFOCUS message to the window that loses the input focus and aWM_SETFOCUS message to the window that receives the input focus.Top
4 楼showmetheway(雪儿甜心)回复于 2003-02-04 19:12:07 得分 0
可是……可是为什么SetActiveWindow()不管用呢?Top
5 楼AthlonxpX86(一坨屎)回复于 2003-02-04 19:28:23 得分 0
gzTop
6 楼Richuen22(Vista)回复于 2003-02-04 20:19:00 得分 25
http://expert.csdn.net/Expert/topic/1365/1365909.xml?temp=.6204645Top
7 楼showmetheway(雪儿甜心)回复于 2003-02-04 22:07:11 得分 0
可是……可是为什么SetActiveWindow()不管用呢?Top
8 楼AthlonxpX86(一坨屎)回复于 2003-02-04 22:15:29 得分 25
The SetActiveWindow function activates a window, but not if the application is in the background. The window will be brought into the foreground (top of Z order) if its application is in the foreground when the system activates the window.Top




