如何做一个窗口,在其他窗口最大化时不占据它的位置?就像Windows的任务栏窗口。

解决方案 »

  1.   

    //窗体总是在前
    SetWindowPos(&wndTopMost,0,0,0,0,SWP_NOSIZE|SWP_NOMOVE);
      

  2.   

    SystemParametersInfo(SPI_SETWORKAREA,0,&DesktopWorkArea,SPIF_SENDCHANGE);用它来设定系统可用的工作区屏幕
    空出一条可以用来放你的程序中间的切换过程比较烦,要多调一下
      

  3.   

    再具体一点:::: //获取系统定义的工作区的大小
    if( SystemParametersInfo(SPI_GETWORKAREA,0,&DesktopWorkArea,0) )
    {
    //如果为恢复
    if(isRestore == TRUE)
    {
    DesktopWorkArea.top = 0 ;
    }
    else
    {
    CRect  DlgRect;
    int    DlgHeight; GetWindowRect(DlgRect);
    DlgHeight = DlgRect.Height(); DlgRect.top = 0;   //DesktopWorkArea.top;
    DlgRect.left = 0;  //DesktopWorkArea.left;
    DlgRect.right = nSysCX;
    DlgRect.bottom = DlgHeight; MoveWindow(DlgRect); DesktopWorkArea.top = DlgRect.Height()+4;
    }SystemParametersInfo(SPI_SETWORKAREA,0,&DesktopWorkArea,SPIF_SENDCHANGE);这样清楚了吧
      

  4.   

    CWnd::BringWindowToTop  
    void BringWindowToTop( );ResBrings CWnd to the top of a stack of overlapping windows. In addition, BringWindowToTop activates pop-up, top-level, and MDI child windows. The BringWindowToTop member function should be used to uncover any window that is partially or completely obscured by any overlapping windows. Calling this function is similar to calling the SetWindowPos function to change a window’s position in the Z-order. The BringWindowToTop function does not change the window style to make it a top-level window of the desktop.
      

  5.   

    将他设为TOPMOST,永远在最上层,不行吗?
      

  6.   

    我试过,BringWindowToTop只能暂时的把它提到最前面,而不能改变它的属性。
    建议用SPY++看看任务栏的属性。建议下载一个WINDOWHACK(好东西大家用)可以看到屏幕上的所有窗口,得到它的窗口类名称,大小,位置。