windows正常工作时,想让任何一个窗口获得焦点时,能够从该窗口提取东西,然后焦点变换时,又从另一个获得焦点的窗口提取东西。大体是这样,那这样的获得焦点函数是什么啊??另外:怎么取得当前活动窗口的句柄?

解决方案 »

  1.   

    SetFocus
    The SetFocus function sets the keyboard focus to the specified window. The window must be associated with the calling thread's message queue. 
    GetFocus
    The GetFocus function retrieves the handle to the window that has the keyboard focus, if the window is associated with the calling thread's message queue. 
      

  2.   

    让窗口响应 WM_SETFOCUS 消息。变换焦点从另一个窗口提取东西就叫另一个窗口也响应WM_SETFOCUS 消息。 
    GetActiveView()函数可以获得当前窗口。
      

  3.   

    响应 WM_SETFOCUS 消息,会添加一个OnSetFocus()的函数啊。
    void CxxxView::OnSetFocus(CWnd* pOldWnd)
    {
        CScrollView::OnSetFocus(pOldWnd);
    }
      

  4.   

    在WM_SETFOCUS或者WM_ACTIVE里写获取代码
      

  5.   

    让窗口响应 WM_SETFOCUS 消息,添加一个OnSetFocus()函数。 
    void CxxxView::OnSetFocus(CWnd* pOldWnd) 

        CScrollView::OnSetFocus(pOldWnd); 
    }
    同时GetActiveView()函数可以获得当前窗口。