问题解决了,但是是同OUTLOOK的类似,还是没有达到FoxMail显示三个窗体时一样的效果<br>把解决方法公布出来,供大家参考<br>在网上看到了下面的文章,觉得有用,所以贴出来,我也是从这个文章中找到解决方法的。<br>解决思路同我上面的想法,就是在创建前将句柄记录下来,然后在截获消息后激活<br> procedure WMMsg(var Message:TMessage); Message WM_WINDOWPOSCHANGED; <br><br>procedure TfrOriginGather.WMMsg(var Message:TMessage);<br>begin<br> if self.Tag>0 then begin<br> ShowWindow(self.Tag, SW_SHOWNORMAL);<br> BringWindowToTop(self.Tag);<br> end;<br> DefWindowProc(self.Handle,Message.Msg,Message.WParam,Message.LParam);<br>end;<br><br>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++<br>在网上瞎逛,看到这样一道题目“鼠标左键点击在非当前窗口的标题栏上,会产生什么样的win32消息?”。当时感觉有点茫然,不就是WM_LBBUTTONDOWN、WM_ACTIVATE和WM_SETFOCUS吗?后来感觉可能不是这么简单,就用Spy++跟踪了一下,果然多了不少消息。<br><br>在NC点击发出的消息流程如下:<br> WM_NCHITTEST<br> //在鼠标点击非激活窗体的时候发出的,如果是点在子窗体上,还会通过DefWindowProc发给父窗体<br> WM_MOUSEACTIVATE<br> //鼠标左键点在NC发出的消息<br> WM_NCLBUTTONDOWN<br> WM_WINDOWPOSCHANGING<br> WM_WINDOWPOSCHANGED<br> //在应用程序切换的时候,用来Deactivate和Activate应用程序<br> WM_ACTIVATEAPP<br> //改变窗体在Activated和Deactivated状态下的NC<br> WM_NCACTIVATE<br> //Activate和Deactivate窗体,在同一个输入消息队列中Deactivate消息在前,随后才是activate消息;在不同的输入消息队列中,这两个消息被异步处理<br> WM_ACTIVATE<br> WM_NCLBUTTONMOVE<br> WM_NCLBUTTONUP<br> //当窗体获取键盘焦点的时候,才会发出这个消息<br> WM_SETFOCUS<br> <br>在用户区的子窗体上点击的消息流程如下:<br> //一般用来处理create、destroyed和鼠标消息,是子窗体发给所属父窗体的消息<br> WM_PARENTNOTIFY(WM_LBUTTONDOWN)<br> WM_MOUSEACTIVATE<br> WM_WINDOWPOSCHANGING<br> WM_WINDOWPOSCHANGED<br> WM_ACTIVATEAPP<br> WM_NCACTIVATE<br> WM_ACTIVATE<br> <br>通过Alt+Tab让该应用程序Deactivate的消息流程如下:<br> //The WM_CANCELMODE message is sent to cancel certain modes, such as mouse capture. For example, the system sends this message to the active window when a dialog box or message box is displayed. Certain functions also send this message explicitly to the specified window regardless of whether it is the active window. For example, the EnableWindow function sends this message when disabling the specified window.<br> WM_CANCELMODE<br> WM_NCACTIVATE(FALSE)<br> WM_ACTIVATE(FALSE)<br> //An application sends the WM_CHANGEUISTATE message to indicate that the user interface (UI) state should be changed<br> WM_CHANGEUISTATE<br> WM_ACTIVATEAPP(FALSE)