B、C都设置为StayOnTop,然后在B的onactivate事件里写
if C.Visible then
SetWindowPos(
C.handle, // handle to window
HWND_TOP, // placement-order handle
C.left, // horizontal position
C.top, // vertical position
C.width, // width
C.height, // height
SWP_NOACTIVATE // window-positioning flags
);
增加B的消息处理:
procedure WMSysCommand(var Message: TMessage); message WM_SYSCOMMAND;
begin
//如果是其它的SystemCommand消息则调用系统缺省处理函数处理之。
DefWindowProc(Handle,Message.Msg,Message.WParam,Message.LParam);
if C.Visible then
SetWindowPos(
C.handle, // handle to window
HWND_TOP, // placement-order handle
C.left, // horizontal position
C.top, // vertical position
C.width, // width
C.height, // height
SWP_NOACTIVATE // window-positioning flags
);
end;