那个消息总是在窗口切换时用到?

oulix 2002-08-19 10:48:57
我想hook Windows消息来准确判断当前工作窗口发生了切换,无论是鼠标,键盘还是
某个程序引起的,各位谈谈自己的理解,讨论个结果出来?
...全文
164 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
wanglei888 2002-08-21
  • 打赏
  • 举报
回复
不好意思,没帮上忙 ^_^
oulix 2002-08-21
  • 打赏
  • 举报
回复
感谢wanglei888(阿笨猫) !
我改用其他办法来处理了,没再找需要hook那些消息才能知道工作窗口切换了。还是很感谢!
oulix 2002-08-19
  • 打赏
  • 举报
回复
up!容我看看
wanglei888 2002-08-19
  • 打赏
  • 举报
回复
你说的这种情况是可以判断出来的:

WM_ACTIVATE
fActive = LOWORD(wParam); // activation flag
fMinimized = (BOOL) HIWORD(wParam); // minimized flag
hwndPrevious = (HWND) lParam; // window handle

Parameters
fActive
Value of the low-order word of wParam. Specifies whether the window is being activated or deactivated. This parameter can be one of the following values. Value Meaning

WA_ACTIVE Activated by some method other than a mouse click (for example, by a call to the SetActiveWindow function or by use of the keyboard interface to select the window).
WA_CLICKACTIVE Activated by a mouse click.
WA_INACTIVE Deactivated.


fMinimized
Value of the high-order word of wParam. Specifies the minimized state of the window being activated or deactivated. A nonzero value indicates the window is minimized.

hwndPrevious
Value of lParam. Handle to the window being activated or deactivated, depending on the value of the fActive parameter. If the value of fActive is WA_INACTIVE, hwndPrevious is the handle to the window being activated. If the value of fActive is WA_ACTIVE or WA_CLICKACTIVE, hwndPrevious is the handle to the window being deactivated. This handle can be NULL.

另外还有两个相关消息:
WM_MOUSEACTIVE 和 WM_NCACTIVE
oulix 2002-08-19
  • 打赏
  • 举报
回复
这个并能保证它成为工作窗口,如果它是在最小化的情况下active的,好像只能闪烁几下,无法恢复程normal的窗口吧。不知道对不对。
wanglei888 2002-08-19
  • 打赏
  • 举报
回复
WM_ACTIVATE ?

16,471

社区成员

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

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

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