比如现在就一个SDI应用程序,在程序里,通过在菜里的一个菜单项"总在最前面"当此项选中时,此窗口便始终处于最前面,否则,其属性正常.

解决方案 »

  1.   

    总在最前面
    BOOL SetWindowPos(
      GetSsfeHwnd(),             // handle to window
      HWND_TOPMOST,  // placement-order handle
      0,                 // horizontal position
      0,                 // vertical position
      0,                // width
      0,                // height
      SWP_NOMOVE | SWP_NOSIZE            // window-positioning options
    );
    恢复
    BOOL SetWindowPos(
      GetSsfeHwnd(),             // handle to window
      HWND_NOTOPMOST,  // placement-order handle
      0,                 // horizontal position
      0,                 // vertical position
      0,                // width
      0,                // height
      SWP_NOMOVE | SWP_NOSIZE            // window-positioning options
    );
      

  2.   

    这个函数本来是在App类里面的InitInstance里被调用的。现在要通过菜单来调用的话,偶不会了
      

  3.   

    你要添加菜单的消息响应函数.在函数里面添加SetWindowPos
      

  4.   

    在mfc classwizard中,
    在object id里面选择菜单项的id,
    在message中选择command,则可添加菜单响应函数