WINDOWS是如何区分三种类型的消息的
例如:点击鼠标,WINDOWS如何知道是菜单命令,还是再客户区,其实现是否在GETMESSAGE()或DispatchMessage()里面
还有就是嵌在客户区里的控件,是否都有自己的消息泵,是如何区分的

解决方案 »

  1.   

    消息的产生与消息泵无关, 
    消息是系统在收到事件后产生的, 系统产生的(当然, 自己也可以用SendMessage, PostMessage 产生)
    消息泵只负责消息的处理...
      

  2.   

    很多东西都是WINDOWS系统处理的,使用菜单,是因为需要一个标准,这样WINDOWS应用程序更容易使用。你问的这些问题很好,不过不是三言两语就能解答,另外一般人也解答不了;有一本书能解答你的问题,它就是《WINDOWS程序设计》,网上有电子书下载。
      

  3.   

    消息类型判断MFC中是在CWnd中的OnWndMsg()函数来判断消息类型至于SDK嘛..不清楚  应该都是GetMessage()内判断的消息的捕获是层层捕获的.先从最低的开始..比如如果由CFrameWnd类派生的CMainWindow没有捕获通常由CFrameWnd捕获的消息,则由相同的由派生类所继承的CFrameWnd类函数来捕获..  如果CFrameWnd没有捕获 则由其父类CWnd来捕获...
      

  4.   

    捕获的消息可以藉由消息参数wParam来区分是那个菜单or控件发出的..
      

  5.   

    消息机制是微软搞的,它给我门提供什么接口我们就用什么,它分成了那么多种消息类型,我们没有选择就只有使用
    每个窗口都有消息处理函数,要去switch(message),不停的case,case,看是什么消息,mfc给我们简化了处理,我们直接用就行
    鼠标点在一个地方,前后做了些什么,那个微软规定了的,我们只管响应菜单命令消息,按钮通知消息,等,
      

  6.   

    处理WM_NCHITTEST消息: 
    UINT CMyDialog::OnNcHitTest(CPoint pt){  CRect rc;  GetClientRect(&rc);  ClientToScreen(&rc);  return rc.PtInRect(pt) ? HTCAPTION : CDialog::OnNcHitTest(pt);}     
      

  7.   

    HTBORDER In the border of a window that does not have a sizing border. 
    HTBOTTOM In the lower-horizontal border of a resizable window (the user can click the mouse to resize the window vertically). 
    HTBOTTOMLEFT In the lower-left corner of a border of a resizable window (the user can click the mouse to resize the window diagonally). 
    HTBOTTOMRIGHT In the lower-right corner of a border of a resizable window (the user can click the mouse to resize the window diagonally). 
    HTCAPTION In a title bar. 
    HTCLIENT In a client area. 
    HTCLOSE In a Close button. 
    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). 
    HTHELP In a Help button. 
    HTHSCROLL In a horizontal scroll bar. 
    HTLEFT In the left border of a resizable window (the user can click the mouse to resize the window horizontally). 
    HTMENU In a menu. 不同返回值的含义
    HTMAXBUTTON In a Maximize button. 
    HTMINBUTTON In a Minimize button. 
    HTNOWHERE On the screen background or on a dividing line between windows. 
    HTREDUCE In a Minimize button. 
    HTRIGHT In the right border of a resizable window (the user can click the mouse to resize the window horizontally). 
    HTSIZE In a size box (same as HTGROWBOX). 
    HTSYSMENU In a window 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 in the same thread (the message will be sent to underlying windows in the same thread until one of them returns a code that is not HTTRANSPARENT). 
    HTVSCROLL In the vertical scroll bar. 
    HTZOOM In a Maximize button. 
      

  8.   

    感谢大家,感谢zaodt,你的提议很好
    我的问题不是很确切,我正是想知道系统方面的问题,