2010-03-03 2 views

답변

1

m_pMainWnd-> InitInstance()의 CenterWindow()?

+0

그래, 그랬어! 정말 고마워. – pFilicetti

0

왼쪽 = (ScreenWidth-WindowWidth)/2 = 가기 (ScreenHeight-WIndowHeight)/2

0

I는 애플리케이션 클래스의 InitInstance의 시동시의 위치 결정을 MDI 않는 애플리케이션을 갖는다. (필자는 메인 프레임의 OnCreate가 실제로 틀린 장소라는 것을 읽은 것을 기억합니다. 그러나 오래 전에 읽은 곳을 모르겠습니다.) 관련 부분을 여기서 제거하려고합니다 :

BOOL CMyApp::InitInstance() 
{ 
    // stuff... 

    CMyMainFrame* pMyMainFrame=CreateMainFrame(); 
    if (!pMyMainFrame) 
     return FALSE; 
    m_pMainWnd = pMyMainFrame; 

    // stuff... 

    if (!ProcessShellCommand(cmdInfo)) 
     return FALSE; 

    int nCmdShow=SW_NORMAL; 
    UINT flags=WPF_SETMINPOSITION; 
    WINDOWPLACEMENT aWndPlacement; 
    CRect rect; 

    // determine the desired rect of the application window 

    aWndPlacement.length=sizeof(WINDOWPLACEMENT); 
    aWndPlacement.showCmd=nCmdShow; 
    aWndPlacement.flags=flags; 
    aWndPlacement.ptMinPosition=CPoint(0,0); 
    aWndPlacement.ptMaxPosition=CPoint(-::GetSystemMetrics(SM_CXBORDER), 
             -::GetSystemMetrics(SM_CYBORDER)); 
    aWndPlacement.rcNormalPosition=rect; 
    m_pMainWnd->SetWindowPlacement(&aWndPlacement); 
    m_nCmdShow=nCmdShow; 

    pMyMainFrame->ShowWindow(m_nCmdShow); 
    pMyMainFrame->UpdateWindow(); 

    return TRUE; 
} 

나는 당신에게 도움이되기를 바랍니다.

관련 문제