鼠标按住窗口的标题栏,消息被截获?

Dlf 2000-06-16 06:31:00
Windows中,当窗口在窗口模式(非最大化或最小化)时
当你用鼠标指向标题栏,按住鼠标的左键不放,这时窗口的消息被截获
不响应,能否不让截获,各位大虾有何高见????
...全文
305 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
茂奇软件 2000-06-20
  • 打赏
  • 举报
回复
I think it is impossible for a normal application.
follow is my reason:
there is only one message handling cycle as we know.
it can not deal the next messaege before end one message
in the GUI thread. I advice you make a work thread. and
use the waitforsingleobject to enumlate a wm_timer.
good lucky
Jansen Zhu.
Dlf 2000-06-20
  • 打赏
  • 举报
回复
各位大虾:
是不是我没有说清楚,我的意思是,在Windows中,当窗口在窗口模式(非最大化或最小化)时当你用鼠标指向标题栏,按住鼠标的左键不放,这时窗口的其他消息 如:
WM_TIMER,等都不响应,这样一来,窗口该刷新的不刷新,该滚动的没滚动。
  • 打赏
  • 举报
回复
可以截Windows消息 WM_NCHITTEST

xPos = LOWORD(lParam); // horizontal position of cursor
yPos = HIWORD(lParam); // vertical position of cursor

返回值就是 xPos, yPos 在窗口的什么位置,你返回什么Windows就认为是什么
比如 xPos, yPos 在 Client 区,你却返回 HTCAPTION 那就认为是在标题栏,可以
用鼠标托走窗口,如果在标题区,你返回的是 HTCLIENT 就认为是在 Client 区
返回值包括以下值:

HTBORDER In the border of a window that does not have a sizing border
HTBOTTOM In the lower horizontal border of a window
HTBOTTOMLEFT In the lower-left corner of a window border
HTBOTTOMRIGHT In the lower-right corner of a window border
HTCAPTION In a title bar
HTCLIENT In a client area
HTERROR On the screen background or on a dividing line between windows (same as HTNOWHERE, except that the DefWindowProc function produces a system beep to indicate an error)
HTGROWBOX In a size box (same as HTSIZE)
HTHSCROLL In a horizontal scroll bar
HTLEFT In the left border of a window
HTMENU In a menu
HTNOWHERE On the screen background or on a dividing line between windows
HTREDUCE In a Minimize button
HTRIGHT In the right border of a window
HTSIZE In a size box (same as HTGROWBOX)
HTSYSMENU In a System menu or in a Close button in a child window
HTTOP In the upper horizontal border of a window
HTTOPLEFT In the upper-left corner of a window border
HTTOPRIGHT In the upper right corner of a window border
HTTRANSPARENT In a window currently covered by another window
HTVSCROLL In the vertical scroll bar
HTZOOM In a Maximize button
quarkfc 2000-06-17
  • 打赏
  • 举报
回复
用Windows钩子最好的。
就使用WH_MOUSE类型的钩子,在钩子函数中判断当前窗口的位置,如果鼠标在标题上就屏蔽鼠标消息即可。
可具体查看SetWindowsHookEx()API,那里有较为详细的说明
windoze 2000-06-16
  • 打赏
  • 举报
回复
能不能先说明你到底要做什么,如果你真的不想截获,调用ReleaseCapture就可以了。

16,472

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧