那个API函数能使窗口到最前面并激活,好象SetForegroundWindow只能到前面,不能激活啊

解决方案 »

  1.   

    ::SetWindowPos(m_hWnd,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE |SWP_NOSIZE);SetActiveWindow(m_hWnd);
      

  2.   

    SetFocus()
    是接收所有的键盘消息!
      

  3.   

    SetWindowPos(&wndTopMost,.....)
    or
    SetFocus()
      

  4.   

    CWnd *hWnd = CWnd::FindWindow(NULL, "EditPlus");

    //hWnd->ShowWindow(SW_RESTORE);
    hWnd->SetActiveWindow();
    hWnd->SetForegroundWindow();
      

  5.   

    BOOL bIcon = ::IsIconic(hCapt);
    if(bIcon){
     ::ShowWindow(hCapt,SW_MAXIMIZE);
    }
    else{
     ::SetActiveWindow(hCapt);
     ::SetForegroundWindow(hCapt);
    }
      

  6.   

    1.暂时挪到最前(别的窗口还可以把它覆盖)
    BOOL BringWindowToTop(
      HWND hWnd   // handle to window
    );
    2.永久挪到最前(别的窗口不能把它覆盖)
    ::SetWindowPos(m_hWnd,&wndTopMost,x,y,cx,cy,SWP_SHOWWINDOW);
      

  7.   

    SetWindowPos(hWin,HWND_TOPMOST,0,0,0,0,SWP_SHOWWINDOW);
    ShowWindow(hWin,SW_RESTORE);
    SetForegroundWindow(hWin);
      

  8.   

    ::SetWindowPos(this->m_hWnd,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE |SWP_NOSIZE);
    ::SetActiveWindow(this->m_hWnd);
    ::SetForegroundWindow(this->m_hWnd);测试过!!      ^_^