解决方案 »

  1.   

    2个函数
    MoveWindow
    CenterWindow

      

  2.   

    左上角:SetWindowPos(m_hWnd, NULL, 0, 0, 0,0,SWP_NOZORDER | SWP_NOSIZE);
    屏幕中间:
    int nScreenCX = ::GetSystemMetrics(SM_CXSCREEN);
    int nScreenCY = ::GetSystemMetrics(SM_CYSCREEN);
    CRect rect;
    GetWindowRect(m_hWnd, rect);
    int x = (nScreenCX  - rect.Width()) / 2;
    int y = (nScreenCY - rect.Height()) / 2;
    SetWindowPos(m_hWnd, NULL, x, y, 0,0,SWP_NOZORDER | SWP_NOSIZE);
     
      

  3.   

    m_hWnd     这参数怎么得到的?
      

  4.   

    CWnd 派生的类都有这个成员。
      

  5.   

    是有这个成员,但是这值不能用在这个函数里面啊
    报这个错 'CWnd::SetWindowPos' : cannot convert parameter 1 from 'HWND' to 'const CWnd *'
      

  6.   

    用全局域 
    ::SetWindowPos如果要用在CWnd派生类中直接使用SetWindowPos成员函数
    需要这样写:
    左上角:SetWindowPos(NULL, 0, 0, 0,0,SWP_NOZORDER | SWP_NOSIZE);
    屏幕中间:
    int nScreenCX = ::GetSystemMetrics(SM_CXSCREEN);
    int nScreenCY = ::GetSystemMetrics(SM_CYSCREEN);
    CRect rect;
    GetWindowRect(& rect);
    int x = (nScreenCX  - rect.Width()) / 2;
    int y = (nScreenCY - rect.Height()) / 2;
    SetWindowPos(NULL, x, y, 0,0,SWP_NOZORDER | SWP_NOSIZE);
      

  7.   


    我用的是vs2005,那个是对话框的哪个属性?MFC对话框不是在资源里吗?打开这个对话框(在VS中),点Alt+Enter,有个窗口属性框(和控件属性差不多),有这一项。
      

  8.   

    谢谢,暂时解决不了,不过上面的方法都是对的,不过是单纯的mfc来说的,我是用mfc开发的wince手持机,显示后跟屏幕上面有一个状态栏似的,不是程序的问题是手持机可能有其它的方法。
    结贴,谢谢各位