CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
IBM Rational 系统开发最佳实践工具包 WebSphere MQ 最佳实践 TOP 15
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  VC/MFC >  进程/线程/DLL

WH_GETMESSAGE 为什么无法取得线程内「所有消息」?

楼主TempterX(兄弟)2006-03-07 18:35:39 在 VC/MFC / 进程/线程/DLL 提问

//*************************************************************  
  都说  
   
  WH_GETMESSAGE   是在   GetMessage   和   PeekMessage   时动作的,  
   
   
   
   
   
  可为什么它也不能取得线程之所有消息呢?  
   
  难道非要按装好几个钩子才能得到   所有消息?  
   
   
   
   
   
  //*************************************************************  
  比如   WM_MOVE   就必须用   WH_CBT   或   WH_CALLWNDPROC   等   来获取。  
   
  但是WH_CALLWNDPROC   又不能取得   WH_LBUTTONUP   等鼠标消息。  
   
  用WH_MOUSE的话只能取得鼠标消息。  
   
  至于   WH_MSGFILTER   好象也不是很好用。  
   
   
   
   
   
   
  //*************************************************************  
  已看msdn,请大家不要再贴。  
   
  WH_CALLWNDPROC  
  Installs   a   hook   procedure   that   monitors   messages   before   the   system   sends   them   to   the   destination   window   procedure.   For   more   information,   see   the   CallWndProc   hook   procedure.  
  WH_CALLWNDPROCRET  
  Installs   a   hook   procedure   that   monitors   messages   after   they   have   been   processed   by   the   destination   window   procedure.   For   more   information,   see   the   CallWndRetProc   hook   procedure.  
  WH_CBT  
  Installs   a   hook   procedure   that   receives   notifications   useful   to   a   computer-based   training   (CBT)   application.   For   more   information,   see   the   CBTProc   hook   procedure.  
  WH_DEBUG  
  Installs   a   hook   procedure   useful   for   debugging   other   hook   procedures.   For   more   information,   see   the   DebugProc   hook   procedure.  
  WH_FOREGROUNDIDLE  
  Installs   a   hook   procedure   that   will   be   called   when   the   application's   foreground   thread   is   about   to   become   idle.   This   hook   is   useful   for   performing   low   priority   tasks   during   idle   time.   For   more   information,   see   the   ForegroundIdleProc   hook   procedure.    
  WH_GETMESSAGE  
  Installs   a   hook   procedure   that   monitors   messages   posted   to   a   message   queue.   For   more   information,   see   the   GetMsgProc   hook   procedure.  
  WH_JOURNALPLAYBACK  
  Installs   a   hook   procedure   that   posts   messages   previously   recorded   by   a   WH_JOURNALRECORD   hook   procedure.   For   more   information,   see   the   JournalPlaybackProc   hook   procedure.  
  WH_JOURNALRECORD  
  Installs   a   hook   procedure   that   records   input   messages   posted   to   the   system   message   queue.   This   hook   is   useful   for   recording   macros.   For   more   information,   see   the   JournalRecordProc   hook   procedure.  
  WH_KEYBOARD  
  Installs   a   hook   procedure   that   monitors   keystroke   messages.   For   more   information,   see   the   KeyboardProc   hook   procedure.  
  WH_KEYBOARD_LL  
  Windows   NT/2000/XP:   Installs   a   hook   procedure   that   monitors   low-level   keyboard   input   events.   For   more   information,   see   the   LowLevelKeyboardProc   hook   procedure.  
  WH_MOUSE  
  Installs   a   hook   procedure   that   monitors   mouse   messages.   For   more   information,   see   the   MouseProc   hook   procedure.  
  WH_MOUSE_LL  
  Windows   NT/2000/XP:   Installs   a   hook   procedure   that   monitors   low-level   mouse   input   events.   For   more   information,   see   the   LowLevelMouseProc   hook   procedure.  
  WH_MSGFILTER  
  Installs   a   hook   procedure   that   monitors   messages   generated   as   a   result   of   an   input   event   in   a   dialog   box,   message   box,   menu,   or   scroll   bar.   For   more   information,   see   the   MessageProc   hook   procedure.  
  WH_SHELL  
  Installs   a   hook   procedure   that   receives   notifications   useful   to   shell   applications.   For   more   information,   see   the   ShellProc   hook   procedure.  
  WH_SYSMSGFILTER  
  Installs   a   hook   procedure   that   monitors   messages   generated   as   a   result   of   an   input   event   in   a   dialog   box,   message   box,   menu,   or   scroll   bar.   The   hook   procedure   monitors   these   messages   for   all   applications   in   the   same   desktop   as   the   calling   thread.   For   more   information,   see   the   SysMsgProc   hook   procedure.  
  问题点数:20、回复次数:1Top

1 楼mscf(扎西特勒)回复于 2006-03-10 13:28:45 得分 20

钩子是在消息从消息队列获取时候被触发的吧  
   
  不是所有的Windows消息都进消息队列的,有些消息直接走向了窗口过程  
   
  估计是这个原因  
   
  时间充裕可以看看这些,呵呵  
   
  http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/messagesandmessagequeues/aboutmessagesandmessagequeues.aspTop

相关问题

  • UNIX下,什么函数可以取得当前线程ID?
  • 关于线程参数传递及CDC *pDC的取得
  • 如何取得对话框线程的Handle
  • 请问:如何取得线程的返回值?谢谢!
  • 如何在SetUnhandledExceptionFilter中取得错误线程
  • 如何通过线程ID取得窗口的HANDLE?
  • 取得当前进程线程数的API是?
  • 关于线程同步取得数据的问题。
  • 线程
  • 有没有一种线程安全的方法来取得一张表的元组个数?

关键词

  • 消息
  • wh
  • hook procedure
  • monitors
  • getmessage
  • see
  • 取得
  • callwndproc
  • mouse
  • 所有

得分解答快速导航

  • 帖主:TempterX
  • mscf

相关链接

  • Visual C++类图书
  • Visual C++类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo