怎样知道前一个活动窗口
zlcad 2000-02-16 01:10:00 我要编一个小程序,其窗口长驻屏幕顶端。当从别的窗口切换到程序窗口时要知道前一个活动窗口,就是即将从活动变成不活动的那个窗口。我使用WM_ACTIVATE消息处理,文档说明如下:
CWnd::OnActivate
afx_msg void OnActivate( UINT nState, CWnd* pWndOther, BOOL bMinimized );
Parameters
nState Specifies whether the CWnd is being activated or deactivated. It can be one of the following values:
WA_INACTIVE The window is being deactivated.
WA_ACTIVE The window is being activated through some method other than a mouse click (for example, by use of the keyboard interface to select the window).
WA_CLICKACTIVE The window is being activated by a mouse click.
pWndOther Pointer to the CWnd being activated or deactivated. The pointer can be NULL, and it may be temporary.
bMinimized Specifies the minimized state of the CWnd being activated or deactivated. A value of TRUE indicates the window is minimized.
If TRUE, the CWnd is being activated; otherwise deactivated.
结果每次切换到程序窗口时pWndOther==NULL,只是从程序窗口切换到别的窗口时pWndOther才有效。不知采用那种方法能可靠地解决次问题,请高手指点,万分感激!