我需要窗口弹出,并且在最前面,但是不是始终的TOPMOST因为
SetWindowPos + HWND_TOPMOST有一定的缺陷但是我用BringWindowToTop和SetForegroundWindow又无法跳到最前面,我觉得联众上海热线等做的游戏提示的效果不错,比如轮到你出牌了,你却还在打字什么的,它会自动跳出来提示你,但是不是topmost的形式,请问是怎么做的,谢谢

解决方案 »

  1.   

    Use the BringWindowToTop function to uncover any window that is partially or completely obscured by other windows. Calling this function is similar to calling the SetWindowPos function to change a window's position in the Z order. BringWindowToTop does not make a window a top-level window. If an application is not in the foreground and wants to be in the foreground, it should call the SetForegroundWindow function. 
      

  2.   

    拜托楼上两位看一下我的内容行不,SetForegroundWindow和BringWindowToTop我都尝试过了,没达到我的要求效果阿
      

  3.   

    SetForegroundWindow和BringWindowToTop都只是不停的在任务栏闪阿闪,提示要到最前端,但就是跳不出来:(
    刚才看错了,楼上是一位不是两位:)
      

  4.   

    我就是用SetForegroundWindow没问题呀。窗口怎么可能不到前台呢?
      

  5.   

    估计楼主把处理代码放的地方不对,比如在OnPaint或OnDraw里了,猜测,那样会出现这种情况。
      

  6.   

    不是,我比如就这样吧,放一个Timer
    在ontimer里相应,但是没用的:(
    应该在timer里也可以阿,timer我设置2妙
    Wmtimer里SetForegroundWindow,
    当我其他窗口把它覆盖的时候,它就在任务条上闪阿闪,就是不跳到最前端显示出来,请问怎么办,谢谢
      

  7.   

    哪怕我放在onpaint和ondraw里,我运行程序(窗口从没有到出现有一个过程的,在此过程中,我切换到其他应用程序窗口)但是我所切换的那个窗口在最上面,那个在ondraw,paint里放过SetForegroundWindow();的窗口就是不跳出来,在任务栏上闪阿闪,奇怪把
      

  8.   

    Windows NT 5.0 and later: An application cannot force a window to the foreground while the user is working with another window. Instead, SetForegroundWindow will activate the window (see SetActiveWindow) and call theFlashWindowEx function to notify the user.
      

  9.   

    if(pWnd!=NULL)
    {
       if(pWnd->IsIcon()
       {
          pWnd->ShowWindow(SW_NOMAL);//正常状态,SW_NOMAL好象写错了, 查 一查
       }
       else
       {
           pWnd->SetForegroundWindow();
       }
    }
      

  10.   

    SetWindowPos有一定的缺陷,不能符合我的特殊要求,因此有没有更好的办法To lightwell(bamboo
    你发的那段英文哪里来的?不会是msdn吧,不可能不能在前端显示阿,至少我知道联众上海热线的游戏是做到这点了,我还记得我当时第一次上班玩,它会莫名其妙的跳出来提示,差点被老总看见,因此我印象很深阿
      

  11.   

    我刚作了一个程序,有这个效果,就是用的SetWindowPos(),效果和你要求的差不多!
      

  12.   

    是吗,假如你运行了,并且别的窗口覆盖了它,那它如果在timer里作为启动条件会不会自动弹出呢
      

  13.   

    CyouDlg::OnInitDialog()
    {
       .........
       SetWindowPos(&CWnd::wndTopMost,....);
    }
      

  14.   

    请各位看了我内容再回答好吗?谢谢
    我不想用SetWindowPos
    而且BringWindowToTop和SetForegroundWindow不能达到要求的效果
    谢谢