请各位指点一下做个类似于QQ窗口那样自动隐藏得窗口怎么实现?

解决方案 »

  1.   

    在WM_TIMER消息中检测程序窗口位置及鼠标位置,判断距离为多少~,然后移动窗体到的桌面的外面或里面(要留一点在里面!)!
      

  2.   

    1)place this in init port:    
      CRect dlgRect; 
          GetWindowRect(dlgRect); 
          CRect desktopRect; 
      GetDesktopWindow()->GetWindowRect(desktopRect);
      MoveWindow((desktopRect.Width() - dlgRect.Width()) / 2, 
      (desktopRect.Height() - dlgRect.Height()) / 2, 0, 0 ); 
      nWidth=dlgRect.Width(); 
      nHeight=dlgRect.Height(); 
      dx=2;
      dy=4; 
      dx1=2*5;
      dy1=2*5;
      SetTimer(1,50 , NULL); 2)
    void CMyAbcDlg::OnTimer(UINT nIDEvent) 
    {
    CRect dlgRect;
    GetWindowRect(dlgRect);

    CRect desktopRect;
    GetDesktopWindow()->GetWindowRect(desktopRect);


    if(nIDEvent == 1)
    {
    MoveWindow(
    (-dx+desktopRect.Width() - dlgRect.Width()) / 2,
    (-dy+desktopRect.Height() - dlgRect.Height()) / 2, 
    +dx+dlgRect.Width(),
    +dy+dlgRect.Height() );

    if(dlgRect.Width() >=nWidth) 
    dx=0; // do not over grow
    if(dlgRect.Height() >=nHeight)
    dy=0; // do not over grow
    if((dlgRect.Width() >=nWidth) && (dlgRect.Height() >=nHeight))
    KillTimer(1); //Stop the timer

    CDialog::OnTimer(nIDEvent);
    }
    }窗口逐渐推出
      

  3.   

    支持 xiaohedou(小黑豆(充电中...))
      

  4.   

    我觉得应该用MOSUE HOOK 来做吧?
      

  5.   

    就用mousemove消息和定时器就能实现,例如当鼠标移动的某个位置后触发OnTimer事件,使窗口显示或消失即可!