MSDN里面说了:
if hWndNewParent is not NULL and the window was previously a child of the desktop, you should clear the WS_POPUP style and set the WS_CHILD style before calling SetParent.就是如果你原来是主窗体要修改style为WS_CHILD的

解决方案 »

  1.   

    这种解释有点牵强,因为程序B的窗口我仍然可以点击下面的按键,而且这个问题,我也很多网站上看见过,包括msdn社区,可是都没有解决。
      

  2.   

    程序B窗口.ModifyStyle(WS_POPUP, WS_CHILD, SWP_FRAMECHANGED);
      

  3.   

    “我在一个程序A中显示程序B的界面,即将程序B主界面设置为程序A的子窗口,通过SetParent函数”楼主的两个界面分属不同的应用程序?我在msdn中看到这样一句话:HWND SetParent( 
      HWND hWndChild, 
      HWND hWndNewParent 
    ); 
    Res
      An 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.