试了一些贴子中的方法,编译之后选择“开始执行(不调试)”能达到我的要求,我的程序在桌面上建了一个快捷方式,双击这个快捷方式就不行了。启动了其它程序后sleep(3000),这个时间足够了。

解决方案 »

  1.   

    CWnd::SetForegroundWindow
    BOOL SetForegroundWindow( );Return ValueNonzero if the function is successful; otherwise 0.ResPuts the thread that created the window into the foreground and activates the window. Keyboard input is directed to the window, and various visual cues are changed for the user. The foreground window is the window with which the user is currently working. The foreground window applies only to top-level windows 
      

  2.   

    是要一直保持在最上面吗?是的话可以用:
    m_pMainWnd->SetWindowPos(&m_pMainWnd->wndTopMost, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);