这里有2个独立的程序A,B,我想把B设置为A的子窗口,这样就可以实现当A最小或最大化时B也跟着变,就象是同一个程序里的2个窗口一样,请问该怎么搞啊?

解决方案 »

  1.   

    修改A窗口关于最大化最小化的消息响应
    当它本身响应这个消息时候,不仅仅把自己最大化最小化,并向其子窗口也传递
    这样一个消息。然后在B的这个消息响应函数,根据比例,来改变自身的大小。
    这样 你在A中点击最大化,2个窗口就都跟着改变了。
      

  2.   

    通过类似一楼的消息机制来处理了SetParent只能处理同一应用程序或桌面窗口,而不能应用于不同程序的窗口间。
      

  3.   


    SetParent 当然可以应用于不同程序的窗口间!给一个例子,将自己程序的窗口的父窗口设为桌面。
    SetParent( FindWindow( _T( "Progman" ), _T( "Program Manager" ) ) );
      

  4.   

    ResAn application can use the SetParent function to set the parent window of a pop-up, overlapped, or child window. The new parent window and the child window must belong to the same application. 
      

  5.   

    谁能解释使用 FindWindow SetParent 的确可以建立两个不同应用程序的关系?
    可以用SPY++看到的。