Esempio n. 1
0
BOOL CGuiFrameWnd::LoadFrame(UINT nIDResource, DWORD dwDefaultStyle, CWnd* pParentWnd, CCreateContext* pContext) 
{
	// only do this once
	ASSERT_VALID_IDR(nIDResource);
	ASSERT(m_nIDHelp == 0 || m_nIDHelp == nIDResource);

	m_nIDHelp = nIDResource; // ID for help context (+HID_BASE_RESOURCE)

	CString strFullString;
	if (strFullString.LoadString(nIDResource))
		AfxExtractSubString(m_strTitle, strFullString, 0); // first sub-string

	VERIFY(AfxDeferRegisterClass(AFX_WNDFRAMEORVIEW_REG));

	// attempt to create the window
	LPCTSTR lpszClass = GetIconWndClass(dwDefaultStyle, nIDResource);
	LPCTSTR lpszTitle = m_strTitle;
	if (!Create(lpszClass, lpszTitle, dwDefaultStyle, rectDefault,pParentWnd, NULL, 0L, pContext))
	{
		return FALSE; // will self destruct on failure normally
	}

	// save the default menu handle
	ASSERT(m_hWnd != NULL);
	m_hMenuDefault = ::GetMenu(m_hWnd);

	// load accelerator resource
	LoadAccelTable(MAKEINTRESOURCE(nIDResource));

	if (pContext == NULL) // send initial update
		SendMessageToDescendants(WM_INITIALUPDATE, 0, 0, TRUE, TRUE);

	return TRUE;
}
Esempio n. 2
0
BOOL COleIPFrameWnd::LoadFrame(UINT nIDResource, DWORD dwDefaultStyle,
	CWnd* pParentWnd, CCreateContext* pContext)
{
	if (pParentWnd != NULL)
		ASSERT_VALID(pParentWnd);

	// only do this once
	ASSERT_VALID_IDR(nIDResource);
	ASSERT(m_nIDHelp == 0 || m_nIDHelp == nIDResource);

	m_nIDHelp = nIDResource;    // ID for help context (+HID_BASE_RESOURCE)

	// create the window (use child window style create)
	CRect rect(0, 0, 0, 0);
	if (!CWnd::Create(NULL, NULL, dwDefaultStyle, rect, pParentWnd,
		nIDResource, pContext))
	{
		return FALSE;   // will self destruct on failure normally
	}

	// load accelerator resource
	LoadAccelTable(MAKEINTRESOURCE(nIDResource));

	return TRUE;
}
Esempio n. 3
0
void CFrame::OnSetPreviewMode(BOOL bPreview, CPrintPreviewState* pState) 
{
	// TODO: Add your specialized code here and/or call the base class
	
	CMDIFrameWnd::OnSetPreviewMode(bPreview, pState);
   if (bPreview)
   {
		m_hAccelTable = NULL;
		LoadAccelTable(MAKEINTRESOURCE(LMFC_IDR_PREVIEW));
   }
}
Esempio n. 4
0
BOOL CFrameWnd::LoadFrame( UINT nIDResource, DWORD dwDefaultStyle, CWnd *pParentWnd,
                           CCreateContext *pContext )
/***************************************************/
{
    m_nIDHelp = nIDResource;

    CString str;
    str.LoadString( nIDResource );
    AfxExtractSubString( m_strTitle, str, 0 );

    HINSTANCE hInstance = AfxFindResourceHandle( MAKEINTRESOURCE( nIDResource ), RT_ICON );
    HICON hIcon = ::LoadIcon( hInstance, MAKEINTRESOURCE( nIDResource ) );
    LPCTSTR lpszClass = AfxRegisterWndClass( CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW, NULL,
                                             (HBRUSH)(COLOR_WINDOW + 1), hIcon );
    LoadAccelTable( MAKEINTRESOURCE( nIDResource ) );
    return( Create( lpszClass, m_strTitle, dwDefaultStyle, rectDefault, pParentWnd,
                    MAKEINTRESOURCE( nIDResource ), 0L, pContext ) );
}
Esempio n. 5
0
BOOL CMDIChildWnd::LoadFrame( UINT nIDResource, DWORD dwDefaultStyle, CWnd *pParentWnd,
                              CCreateContext *pContext )
/******************************************************/
{
    if( pContext != NULL ) {
        CMultiDocTemplate *pTemplate = (CMultiDocTemplate *)pContext->m_pNewDocTemplate;
        if( pTemplate != NULL ) {
            ASSERT( pTemplate->IsKindOf( RUNTIME_CLASS( CMultiDocTemplate ) ) );
            m_hMenuShared = pTemplate->m_hMenuShared;
            m_hAccelTable = pTemplate->m_hAccelTable;
        }
    }

    HINSTANCE hInstance = AfxFindResourceHandle( MAKEINTRESOURCE( nIDResource ), RT_ICON );
    HICON hIcon = ::LoadIcon( hInstance, MAKEINTRESOURCE( nIDResource ) );
    LPCTSTR lpszClass = AfxRegisterWndClass( CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW, NULL,
                                             (HBRUSH)(COLOR_WINDOW + 1), hIcon );
    m_strTitle.LoadString( nIDResource );
    LoadAccelTable( MAKEINTRESOURCE( nIDResource ) );
    return( Create( lpszClass, m_strTitle, dwDefaultStyle, rectDefault,
                    (CMDIFrameWnd *)pParentWnd, pContext ) );
}
Esempio n. 6
0
void CFrameWnd::OnSetPreviewMode( BOOL bPreview, CPrintPreviewState *pState )
/***************************************************************************/
{
    ASSERT( pState != NULL );
    
    DWORD       dwSaveStates = 0L;
    POSITION    position = m_listControlBars.GetHeadPosition();
    while( position != NULL ) {
        CControlBar *pBar = (CControlBar *)m_listControlBars.GetNext( position );
        ASSERT( pBar != NULL );
        ASSERT( pBar->IsKindOf( RUNTIME_CLASS( CControlBar ) ) );

        DWORD dwID = pBar->GetDlgCtrlID();
        if( dwID >= AFX_IDW_CONTROLBAR_FIRST && dwID < AFX_IDW_CONTROLBAR_FIRST + 32 ) {
            DWORD dwThisState = AFX_CONTROLBAR_MASK( dwID );
            if( pBar->IsWindowVisible() ) {
                dwSaveStates |= dwThisState;
            }
            if( !(pBar->IsDockBar() && pBar->GetDlgCtrlID() == AFX_IDW_DOCKBAR_FLOAT) ) {
                ShowControlBar( pBar, pState->dwStates & dwThisState, TRUE );
            }
        }
    }
    pState->dwStates = dwSaveStates;
    
    if( bPreview ) {
        m_lpfnCloseProc = pState->lpfnCloseProc;
        
        pState->hMenu = ::GetMenu( m_hWnd );
        ::SetMenu( m_hWnd, NULL );
        pState->hAccelTable = m_hAccelTable;
        m_hAccelTable = NULL;
        LoadAccelTable( MAKEINTRESOURCE( AFX_IDR_PREVIEW_ACCEL ) );

        HWND hWndPane = ::GetDlgItem( m_hWnd, pState->nIDMainPane );
        if( hWndPane != NULL ) {
            ::ShowWindow( hWndPane, SW_HIDE );
        }
        hWndPane = ::GetDlgItem( m_hWnd, AFX_IDW_PANE_FIRST );
        if( hWndPane != NULL ) {
            ::SetWindowLong( hWndPane, GWL_ID, AFX_IDW_PANE_SAVE );
        }
    } else {
        m_lpfnCloseProc = NULL;
        
        if( pState->hMenu != NULL ) {
            ::SetMenu( m_hWnd, pState->hMenu );
            pState->hMenu = NULL;
        }
        if( pState->hAccelTable != NULL ) {
            m_hAccelTable = pState->hAccelTable;
            pState->hAccelTable = NULL;
        }

        HWND hWndPane = ::GetDlgItem( m_hWnd, AFX_IDW_PANE_SAVE );
        if( hWndPane != NULL ) {
            ::SetWindowLong( hWndPane, GWL_ID, AFX_IDW_PANE_FIRST );
        }
        hWndPane = ::GetDlgItem( m_hWnd, pState->nIDMainPane );
        if( hWndPane != NULL ) {
            ::ShowWindow( hWndPane, SW_SHOW );
        }
    }
}
Esempio n. 7
0
CMainWindow::CMainWindow()
{
    LoadAccelTable( _T("MainAccelTable") );
    Create( NULL, _T("Hello Foundation Application"),
        WS_OVERLAPPEDWINDOW, rectDefault, NULL, _T("MainMenu") );
}