Esempio n. 1
0
void CMainFrame::OnChangeLook ()
{
	BOOL bIsLook2003 = CMFCVisualManager::GetInstance ()->IsKindOf (
		RUNTIME_CLASS (CMFCVisualManagerOffice2003));

	m_wndRulerBar.CreateGDIObjects ();
	m_wndRulerBar.RedrawWindow ();

	CWindowDC dc (NULL);
	int nBitsPerPixel = dc.GetDeviceCaps (BITSPIXEL);

	m_wndTaskPane.UpdateIcons ();
	m_wndTaskPane.EnableNavigationToolbar (bIsLook2003,
		theApp.m_bHiColorIcons && nBitsPerPixel > 16 ? IDB_TASKSPANE_TOOLBAR : 0, CSize (16, 16));
	m_wndTaskPane.RecalcLayout (FALSE);

	//-----------------------
	// Reload toolbar images:
	//-----------------------
	CMFCToolBar::ResetAllImages ();

	m_wndToolBar.LoadBitmap (
		theApp.m_bHiColorIcons && nBitsPerPixel > 16 ? IDB_MAINFRAME_HC : IDR_MAINFRAME);

	m_wndFormatBar.LoadBitmap (IDR_FORMATBAR);

	CMFCToolBar::AddToolBarForImageCollection (IDR_TOOLBAR_IMAGES, 
		theApp.m_bHiColorIcons && nBitsPerPixel > 16 ? IDR_TOOLBAR_IMAGES_HC : 0);

	CMFCToolBar::AddToolBarForImageCollection (IDR_BORDER_TYPE, IDR_BORDER_TYPE);

	RecalcLayout ();
	RedrawWindow (NULL, NULL, RDW_ALLCHILDREN | RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE);
}
void CKofRichEditCtrl::OnNcPaint()
{
	const BOOL bHasScrollBars = ((GetStyle () & WS_VSCROLL) == WS_VSCROLL) || ((GetStyle () & WS_HSCROLL) == WS_HSCROLL);

	CWindowDC dc (this);
	CRect rectWindow;
	GetWindowRect (rectWindow);

	if ((!TRUE && !FALSE))
	{
		CRichEditCtrl::OnNcPaint ();
	}
	else
	{
		if (bHasScrollBars)
		{
			CRichEditCtrl::OnNcPaint ();
		}
		CRect rectBorder = rectWindow;
		rectBorder.bottom -= rectBorder.top;
		rectBorder.right -= rectBorder.left;
		rectBorder.left = rectBorder.top = 0;
		CKofStyleHelper::GetInstance()->OnDrawEditBorder(&dc, rectBorder, FALSE, FALSE, IsWindowEnabled());
		rectBorder.DeflateRect(1, 1);
		dc.Draw3dRect(rectBorder, afxGlobalData.clrWindow, afxGlobalData.clrWindow);
	}

	if (GetStyle () & WS_BORDER)
	{
		CMFCVisualManager::GetInstance()->OnDrawControlBorder (this);
	}
}
//--------------------------------------------------------------------------------------//
void CBCGPDragFrameImpl::DrawDragFrame (LPCRECT lpRectOld, LPCRECT lpRectNew, 
										BOOL bFirstTime, int nNewThickness, 
										int nOldThikness)
{
	CWindowDC dc (m_pDraggedWnd->GetDesktopWindow ());

	CSize szNewThickness (nNewThickness, nNewThickness);
	CSize szOldThickness (nOldThikness, nOldThikness);

    CBCGPSmartDockingManager* pSDManager = NULL;

    if (m_pDockManager != NULL
        && (pSDManager = m_pDockManager->GetSDManagerPermanent()) != NULL
        && pSDManager->IsStarted())
    {
        pSDManager->ShowPlaceAt (lpRectNew);
    } 
	else
	{
		if (bFirstTime)
		{
			dc.DrawDragRect (lpRectNew, szNewThickness, NULL, szOldThickness);
		}
		else
		{
			dc.DrawDragRect (lpRectNew, szNewThickness, lpRectOld, szOldThickness);
		}
	}
}
//*****************************************************************************
void CBCGPCaptionBar::OnNcPaint() 
{
	CWindowDC	dcWin (this);

	CRect rectClient;
	GetClientRect(rectClient);

	CRect rectWindow;
	GetWindowRect(rectWindow);

	CRect rectBorder = rectWindow;

	ScreenToClient(rectWindow);

	rectClient.OffsetRect(-rectWindow.left, -rectWindow.top);
	dcWin.ExcludeClipRect (rectClient);
	
	rectBorder.OffsetRect(-rectBorder.left, -rectBorder.top);

	int nBorderSize = m_bIsMessageBarMode ? 0 : m_nBorderSize;

	int nTop = rectBorder.top;
	rectBorder.top = rectBorder.bottom - nBorderSize;
	OnDrawBorder  (&dcWin, rectBorder);

	rectBorder.top = nTop;
	rectBorder.bottom = rectBorder.top + nBorderSize;

	OnDrawBorder  (&dcWin, rectBorder);
	dcWin.SelectClipRgn (NULL);
}
Esempio n. 5
0
// **************************************************************************
// OnChar ()
//
// Description:
//	Handle keyboard input.  Switch view on tab, etc.
//
// Parameters:
//  UINT		nChar		Character code
//	UINT		nRepCnt		repeat count
//	UINT		nFlags		Flags
//
// Returns:
//  void
// **************************************************************************
void CKListEdit::OnChar (UINT nChar, UINT nRepCnt, UINT nFlags) 
	{
	// Filter escape and return:
	if (nChar == VK_ESCAPE || nChar == VK_RETURN)	
		{		
		if (nChar == VK_ESCAPE)
			m_bESC = TRUE;		
		
		GetParent ()->SetFocus ();		
		return;	
		}

	// Perform default processing:
	CEdit::OnChar (nChar, nRepCnt, nFlags);	

	// Get text extent:
	CString strText;
	GetWindowText (strText);	

	CWindowDC dc (this);
	CFont *pFont = GetParent ()->GetFont ();
	CFont *pFontDC = dc.SelectObject (pFont);
	CSize size = dc.GetTextExtent (strText);	
	dc.SelectObject (pFontDC);

	// add some extra buffer	
	size.cx += 5;
	
	// Get client rectangle:
	CRect rect; 
	CRect parentrect;	

	GetClientRect (&rect);
	GetParent ()->GetClientRect (&parentrect);

	// Transform rectangle to parent coordinates:
	ClientToScreen (&rect);
	GetParent ()->ScreenToClient (&rect);

	// Check whether control needs to be resized and whether there is space to grow:	
	if (size.cx > rect.Width ())	
		{
		if (size.cx + rect.left < parentrect.right)
			rect.right = rect.left + size.cx;		
		else			
			rect.right = parentrect.right;

		MoveWindow (&rect);	
		}

	// Send notification to parent of the list control that edit was made:
	GetParent ()->GetParent ()->SendMessage (UM_LISTEDIT_ITEMCHANGE, m_iSubItem, m_iItem);
	}
Esempio n. 6
0
void CBCGPBreadcrumb::BeginInplaceEditing ()
{
	ASSERT(m_pInplaceEdit == NULL);

	CRect rectEdit;
	SendMessage(BCCM_GETINPLACEEDITRECT, 0, (LPARAM)(LPRECT)rectEdit);

	CFont* pFont = GetFont (); // breadcrumb font
	if (pFont == NULL)
	{
		pFont = CFont::FromHandle ((HFONT)::GetStockObject (DEFAULT_GUI_FONT));
	}

	// Adjust editor vertically

	int height = rectEdit.Height ();
	{
		CWindowDC dc (NULL);
		CBCGPFontSelector font (dc, pFont);

		TEXTMETRIC tm;
		dc.GetTextMetrics (&tm);
		height = tm.tmHeight + tm.tmInternalLeading + 1;
	}

	if (height < rectEdit.Height ())
	{
		rectEdit.top += (rectEdit.Height () - height) / 2 + 1;
	}

	// Create an inplace edit

	m_pInplaceEdit = CreateInplaceEdit (this, rectEdit, IDC_BREADCRUMB_INPLACE_EDITOR);

	ASSERT_VALID (m_pInplaceEdit);
	ASSERT (m_pInplaceEdit->GetParent () == this);
	ASSERT (m_pInplaceEdit->GetDlgCtrlID () == IDC_BREADCRUMB_INPLACE_EDITOR);
	
	m_pInplaceEdit->SetFont (pFont);

	m_pInplaceEdit->SetWindowText (GetSelectedPath ());
	m_pInplaceEdit->SetSel (0, -1); // select all
	m_pInplaceEdit->ShowWindow (SW_SHOW);

	m_pInplaceEdit->SetFocus ();
}
Esempio n. 7
0
void _GLOBAL_DATA::OnSysColorChange()
{
	m_crBtnFace = GetSysColor(COLOR_BTNFACE);
	m_crBtnShadow = GetSysColor(COLOR_BTNSHADOW);
	m_crBtnDkShadow = GetSysColor(COLOR_3DDKSHADOW);
	m_crBtnLight = GetSysColor(COLOR_3DLIGHT);
	m_crBtnHilite = GetSysColor(COLOR_BTNHIGHLIGHT);
	m_crBtnText = GetSysColor(COLOR_BTNTEXT);
	m_crTextGrayed = GetSysColor (COLOR_GRAYTEXT);
	m_crWindowFrame = GetSysColor(COLOR_WINDOWFRAME);
	
	m_crHilite = GetSysColor(COLOR_HIGHLIGHT);
	m_crTextHilite = GetSysColor(COLOR_HIGHLIGHTTEXT);
	m_crWindowText = GetSysColor(COLOR_WINDOWTEXT);
	m_crBtn3dShadow = GetSysColor(COLOR_3DSHADOW);
	m_crBtn3dHiLight = GetSysColor(COLOR_3DHILIGHT);
	m_crAcCaption = GetSysColor(COLOR_ACTIVECAPTION);
	m_crInAcCaption = GetSysColor(COLOR_INACTIVECAPTION);
	m_crInAcCaptionText = GetSysColor(COLOR_INACTIVECAPTIONTEXT);
	m_crDesktop = GetSysColor(COLOR_DESKTOP);
	
	//m_cr3dFace = gfxData.m_cr3dFace;
#ifdef COLOR_HOTLIGHT
	
	OSVERSIONINFO osvi;
    osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
	
	::GetVersionEx (&osvi);
	if (osvi.dwMajorVersion >= 5)
	{
		m_crTextHot = GetSysColor (COLOR_HOTLIGHT);
	}
	else
#endif
	{
		m_crTextHot = RGB (0, 0, 255);	// Light blue
	}
	
	CWindowDC dc (NULL);
	m_nBitsPerPixel = dc.GetDeviceCaps (BITSPIXEL);
	
}
void CDittoWindow::DrawMinimizeBtn(CWindowDC &dc)
{
	if(m_bDrawMinimize == false)
	{
		return;
	}

	//rows first then columns
	int Points[5][6] =
	{
			0,0,0,0,0,0,
			0,0,0,0,0,0,
			0,0,0,0,0,0,
			1,1,1,1,1,0,
			1,1,1,1,1,0
	};

	CPoint ptShift = m_crMinimizeBT.TopLeft();
	ptShift.Offset(3, 3);

	if(m_bMouseDownOnMinimize)
	{
		dc.Draw3dRect(m_crMinimizeBT, RGB(255, 255, 255), RGB(255, 255, 255));
		CRect cr(m_crMinimizeBT);
		cr.DeflateRect(1, 1, 1, 1);
		dc.Draw3dRect(cr, RGB(255, 255, 255), RGB(255, 255, 255));
	}
	else if(m_bMouseOverMinimize)
	{
		dc.Draw3dRect(m_crMinimizeBT, RGB(255, 255, 255), RGB(255, 255, 255));
	}

	for (int iRow = 0; iRow < 5; iRow++)
	{
		for (int iCol = 0; iCol < 6; iCol++)
		{
			if (Points[iRow][iCol] == 1)
				dc.SetPixel(ptShift+CPoint(iCol, iRow), RGB(255, 255, 255));
		}
	}
}
//**********************************************************************************
CSize CBCGPAutoHideButton::GetTextSize () const
{
	CSize size (0, 0);

	if (m_pAutoHideWindow != NULL && m_pParentBar != NULL)
	{
		CString strText;
		m_pAutoHideWindow->GetWindowText (strText);	

		if (!strText.IsEmpty ())
		{
			CWindowDC dc (m_pParentBar);

			CFont* pFontOld = (CFont*) dc.SelectObject (IsHorizontal () ? 
										&globalData.fontRegular : &globalData.fontVert);
			ASSERT (pFontOld != NULL);
			size = dc.GetTextExtent (strText);
			size.cx += m_nMarginSize;
			size.cy += m_nMarginSize;

			dc.SelectObject (pFontOld);

			if (!IsHorizontal ())
			{
				int n = size.cy;
				size.cy = size.cx;
				size.cx = n;
			}

		}

		if (!m_pParentBar->m_bActiveInGroup && m_bOverlappingTabs)
		{
			IsHorizontal () ? size.cx = 0 : size.cy = 0;
		}	
	}
	return size;
}
Esempio n. 10
0
//*****************************************************************************
CString CFontItem::FormatProperty ()
{
	CBCGPGridCtrl* pGridCtrl = GetOwnerList ();
	ASSERT_VALID (pGridCtrl);

	CWindowDC dc (pGridCtrl);

	int nLogY = dc.GetDeviceCaps (LOGPIXELSY);

	CString str;

	if (nLogY != 0)
	{
		str.Format( _T("%s(%i)"), m_lf.lfFaceName, 
			MulDiv (72, -m_lf.lfHeight, nLogY));
	}
	else
	{
		str = m_lf.lfFaceName;
	}

	return str;
}
CSize GetWindowTextExtent (CWnd* pControl, const CString& strText, CFont* pFont = NULL)
{
	if (pFont == NULL && pControl != NULL)
	{
		ASSERT (pControl != NULL);
		pFont = pControl->GetFont ();
	}

	CWindowDC dc (pControl);

	CFont* pOldFont = NULL;
	if (pFont != NULL)
	{
		dc.SelectObject (pFont);
	}

	CSize szText = dc.GetTextExtent (strText);

	if (pFont != NULL)
	{
		dc.SelectObject (pOldFont);
	}
	return szText;
}
Esempio n. 12
0
void 
CEditCell::OnChar (UINT nChar, UINT nRepCnt, UINT nFlags)
{
    BOOL Shift = GetKeyState(VK_SHIFT) < 0;
    switch (nChar)
    {
		case VK_ESCAPE :
		{
			if (Shift)
				// Shift+Escape -> disable autocomplete
				m_DoSuggest = FALSE;
			else {
				m_bEscape = TRUE;
				GetParent()->SetFocus();
			}
			return;
		}
		case VK_RETURN :
		{
			SetListText();
			if (m_SubItem == 0)
				m_pListCtrl->EditSubItem (m_Item, 1);
			else
				m_pListCtrl->EditSubItem (m_Item + 1, 0);
			return;
		}
		case VK_TAB :
		{
			if (Shift)
			{
				if (m_SubItem > 0)
					m_pListCtrl->EditSubItem (m_Item, m_SubItem - 1);
				else
				{
					if (m_Item > 0)
						m_pListCtrl->EditSubItem (m_Item - 1, 2);
				}
			}
			else
			{
				if (m_SubItem == 0)
					m_pListCtrl->EditSubItem (m_Item, 1);
				else if (m_SubItem < 2)
					m_pListCtrl->EditSubItem (m_Item, m_SubItem + 1);				
				else
					m_pListCtrl->EditSubItem (m_Item + 1, 0);
			}
			return;
		}
    }

    CEdit::OnChar (nChar, nRepCnt, nFlags);

    // Get text
    CString Text;
    GetWindowText(Text);

	// Make some suggestion
	if (m_DoSuggest && nChar != 8 && m_AutoComplete != NULL) {
		int iSelStart;
		int iSelEnd;
		GetSel(iSelStart, iSelEnd);
		CString sugg = GetSuggestion(Text);
		if (!sugg.IsEmpty()) {
			Text = sugg;
			SetWindowText(Text);
			SetSel(iSelStart, Text.GetLength());
		}
	}

    // Resize edit control if needed

    CWindowDC DC (this);
    CFont *pFont = GetParent()->GetFont();
    CFont *pFontDC = DC.SelectObject (pFont);
    CSize Size = DC.GetTextExtent (Text);
    DC.SelectObject (pFontDC);
    Size.cx += 5;			   	// add some extra buffer

    // Get client rect
    CRect Rect, ParentRect;
    GetClientRect (&Rect);
    GetParent()->GetClientRect (&ParentRect);

    // Transform rect to parent coordinates
    ClientToScreen (&Rect);
    GetParent()->ScreenToClient (&Rect);

    // Check whether control needs to be resized and whether there is space to grow
    if (Size.cx > Rect.Width())
    {
		if (Size.cx + Rect.left < ParentRect.right )
			Rect.right = Rect.left + Size.cx;
		else
			Rect.right = ParentRect.right;
		MoveWindow (&Rect);
    }
}
Esempio n. 13
0
void CSTEditorApp::SetSettingDefaults(SECEditSettings& rtSettings)
{
    CString sExtension = rtSettings.GetFileMappingKey();

    if(sExtension.CompareNoCase(_T("ST")) == 0)
    {
        // sizeof (LOGFONT) gives you the maximum size of a LOGFONT structure.
        // CGdiObject::GetObject possibly returns less because the font name
        // at the end of the LOGFONT structure may not take the whole space
        // reserved for it.
        HFONT       hFont;
        LOGFONT     logFont;
        CGdiObject* pGdiObject;

        hFont = (HFONT)GetStockObject (ANSI_FIXED_FONT);
        pGdiObject = CGdiObject::FromHandle (hFont);
        if (pGdiObject != NULL && pGdiObject->GetObject (sizeof (LOGFONT), &logFont) != 0)
        {
            int iFontSize;
            CWindowDC dc (m_pMainWnd);

            rtSettings.SetFontName(logFont.lfFaceName);
            iFontSize = MulDiv (logFont.lfHeight, 72, dc.GetDeviceCaps (LOGPIXELSY));
            rtSettings.SetFontSize(iFontSize);
            rtSettings.SetFontWeight(logFont.lfWeight);
            rtSettings.SetFontItalic(logFont.lfItalic);
            rtSettings.SetCharSet(logFont.lfCharSet);
        }

        rtSettings.SetCase(FALSE);                          // keywords are case insensitive
        rtSettings.SetChroma(TRUE);                         // coloring enabled
        rtSettings.SetBackgroundCol(RGB(255,255,255));      // background color white
        rtSettings.SetTextColDefault(RGB(0,0,0));           // text color black
        rtSettings.SetTextColKeyword(RGB(0,0,192));         // keyword color middle blue
        rtSettings.SetTextColQuote(RGB(128,128,128));       // string color grey
        rtSettings.SetTextColComment(RGB(0,128,0));         // comment color dark green
        rtSettings.SetCommentStart1(_T("(*"));              // comments start with (*
        rtSettings.SetCommentEnd1(_T("*)"));                // comments end with *)
        rtSettings.SetKeepTabs(TRUE);                       // tabs are not converted to spaces
        rtSettings.SetShowTabs(FALSE);                      // tabs are not visualized
        rtSettings.SetTabSize(4);                           // tab is as wide as 4 spaces
        rtSettings.SetKeywordFile(_T("stkeywords.ini"));    // set keyword ini file
    }
    else if(sExtension.CompareNoCase(_T("IL")) == 0)
    {
        rtSettings.SetCase(FALSE);                          // keywords are case insensitive
        rtSettings.SetChroma(TRUE);                         // coloring enabled
        rtSettings.SetBackgroundCol(RGB(255,255,255));      // background color white
        rtSettings.SetTextColDefault(RGB(0,0,0));           // text color black
        rtSettings.SetTextColKeyword(RGB(0,0,192));         // keyword color middle blue
        rtSettings.SetTextColQuote(RGB(128,128,128));       // string color grey
        rtSettings.SetTextColComment(RGB(0,128,0));         // comment color dark green
        rtSettings.SetCommentStart1(_T("(*"));              // comments start with (*
        rtSettings.SetCommentEnd1(_T("*)"));                // comments end with *)
        rtSettings.SetKeepTabs(TRUE);                       // tabs are not converted to spaces
        rtSettings.SetShowTabs(FALSE);                      // tabs are not visualized
        rtSettings.SetTabSize(8);                           // tab is as wide as 8 spaces
        rtSettings.SetKeywordFile(_T("ilkeywords.ini"));    // set keyword ini file
    }
    else if(sExtension.CompareNoCase(_T("4CH")) == 0)
    {
        rtSettings.SetCase(FALSE);                          // keywords are case insensitive
        rtSettings.SetChroma(TRUE);                         // coloring enabled
        rtSettings.SetBackgroundCol(RGB(255,255,255));      // background color white
        rtSettings.SetTextColDefault(RGB(0,0,0));           // text color black
        rtSettings.SetTextColKeyword(RGB(0,0,192));         // keyword color middle blue
        rtSettings.SetTextColQuote(RGB(128,128,128));       // string color grey
        rtSettings.SetTextColComment(RGB(0,128,0));         // comment color dark green
        rtSettings.SetCommentStart1(_T("(*"));              // comments start with (*
        rtSettings.SetCommentEnd1(_T("*)"));                // comments end with *)
        rtSettings.SetKeepTabs(TRUE);                       // tabs are not converted to spaces
        rtSettings.SetShowTabs(FALSE);                      // tabs are not visualized
        rtSettings.SetTabSize(4);                           // tab is as wide as 4 spaces
        rtSettings.SetKeywordFile(_T("4chkeywords.ini"));   // set keyword ini file
    }
    else if(sExtension.CompareNoCase(_T("CON")) == 0)
    {
        rtSettings.SetCase(FALSE);                          // keywords are case insensitive
        rtSettings.SetChroma(TRUE);                         // coloring enabled
        rtSettings.SetBackgroundCol(RGB(255,255,255));      // background color white
        rtSettings.SetTextColDefault(RGB(0,0,0));           // text color black
        rtSettings.SetTextColKeyword(RGB(0,0,192));         // keyword color middle blue
        rtSettings.SetTextColQuote(RGB(128,128,128));       // string color grey
        rtSettings.SetTextColComment(RGB(0,128,0));         // comment color dark green
        rtSettings.SetCommentStart1(_T("(*"));              // comments start with (*
        rtSettings.SetCommentEnd1(_T("*)"));                // comments end with *)
        rtSettings.SetKeepTabs(TRUE);                       // tabs are not converted to spaces
        rtSettings.SetShowTabs(FALSE);                      // tabs are not visualized
        rtSettings.SetTabSize(4);                           // tab is as wide as 4 spaces
        rtSettings.SetKeywordFile(_T("stkeywords.ini"));    // set keyword ini file
    }
    else if(sExtension.CompareNoCase(_T("CST")) == 0)
    {
        rtSettings.SetCase(FALSE);                          // keywords are case insensitive
        rtSettings.SetChroma(TRUE);                         // coloring enabled
        rtSettings.SetBackgroundCol(RGB(255,255,255));      // background color white
        rtSettings.SetTextColDefault(RGB(0,0,0));           // text color black
        rtSettings.SetTextColKeyword(RGB(0,0,192));         // keyword color middle blue
        rtSettings.SetTextColQuote(RGB(128,128,128));       // string color grey
        rtSettings.SetTextColComment(RGB(0,128,0));         // comment color dark green
        rtSettings.SetCommentStart1(_T("(*"));              // comments start with (*
        rtSettings.SetCommentEnd1(_T("*)"));                // comments end with *)
        rtSettings.SetKeepTabs(TRUE);                       // tabs are not converted to spaces
        rtSettings.SetShowTabs(FALSE);                      // tabs are not visualized
        rtSettings.SetTabSize(4);                           // tab is as wide as 4 spaces
        rtSettings.SetKeywordFile(_T("stkeywords.ini"));    // set keyword ini file
    }
    else if(sExtension.CompareNoCase(_T("GVL")) == 0)
    {
        rtSettings.SetCase(FALSE);                          // keywords are case insensitive
        rtSettings.SetChroma(TRUE);                         // coloring enabled
        rtSettings.SetBackgroundCol(RGB(255,255,255));      // background color white
        rtSettings.SetTextColDefault(RGB(0,0,0));           // text color black
        rtSettings.SetTextColKeyword(RGB(0,0,192));         // keyword color middle blue
        rtSettings.SetTextColQuote(RGB(128,128,128));       // string color grey
        rtSettings.SetTextColComment(RGB(0,128,0));         // comment color dark green
        rtSettings.SetCommentStart1(_T("(*"));              // comments start with (*
        rtSettings.SetCommentEnd1(_T("*)"));                // comments end with *)
        rtSettings.SetKeepTabs(TRUE);                       // tabs are not converted to spaces
        rtSettings.SetShowTabs(FALSE);                      // tabs are not visualized
        rtSettings.SetTabSize(4);                           // tab is as wide as 4 spaces
        rtSettings.SetKeywordFile(_T("stkeywords.ini"));    // set keyword ini file
    }
    else if(sExtension.CompareNoCase(_T("SDT")) == 0)
    {
        rtSettings.SetCase(FALSE);                          // keywords are case insensitive
        rtSettings.SetChroma(TRUE);                         // coloring enabled
        rtSettings.SetBackgroundCol(RGB(255,255,255));      // background color white
        rtSettings.SetTextColDefault(RGB(0,0,0));           // text color black
        rtSettings.SetTextColKeyword(RGB(0,0,192));         // keyword color middle blue
        rtSettings.SetTextColQuote(RGB(128,128,128));       // string color grey
        rtSettings.SetTextColComment(RGB(0,128,0));         // comment color dark green
        rtSettings.SetCommentStart1(_T("(*"));              // comments start with (*
        rtSettings.SetCommentEnd1(_T("*)"));                // comments end with *)
        rtSettings.SetKeepTabs(TRUE);                       // tabs are not converted to spaces
        rtSettings.SetShowTabs(FALSE);                      // tabs are not visualized
        rtSettings.SetTabSize(4);                           // tab is as wide as 4 spaces
        rtSettings.SetKeywordFile(_T("stkeywords.ini"));    // set keyword ini file
    }
    else if(sExtension.CompareNoCase(_T("RES")) == 0)
    {
        rtSettings.SetCase(FALSE);                          // keywords are case insensitive
        rtSettings.SetChroma(TRUE);                         // coloring enabled
        rtSettings.SetBackgroundCol(RGB(255,255,255));      // background color white
        rtSettings.SetTextColDefault(RGB(0,0,0));           // text color black
        rtSettings.SetTextColKeyword(RGB(0,0,192));         // keyword color middle blue
        rtSettings.SetTextColQuote(RGB(128,128,128));       // string color grey
        rtSettings.SetTextColComment(RGB(0,128,0));         // comment color dark green
        rtSettings.SetCommentStart1(_T("(*"));              // comments start with (*
        rtSettings.SetCommentEnd1(_T("*)"));                // comments end with *)
        rtSettings.SetKeepTabs(TRUE);                       // tabs are not converted to spaces
        rtSettings.SetShowTabs(FALSE);                      // tabs are not visualized
        rtSettings.SetTabSize(4);                           // tab is as wide as 4 spaces
        rtSettings.SetKeywordFile(_T("stkeywords.ini"));    // set keyword ini file
    }
    else if(sExtension.CompareNoCase(_T("HDR")) == 0)
    {
        rtSettings.SetCase(FALSE);                          // keywords are case insensitive
        rtSettings.SetChroma(TRUE);                         // coloring enabled
        rtSettings.SetBackgroundCol(RGB(255,255,255));      // background color white
        rtSettings.SetTextColDefault(RGB(0,0,0));           // text color black
        rtSettings.SetTextColKeyword(RGB(0,0,192));         // keyword color middle blue
        rtSettings.SetTextColQuote(RGB(128,128,128));       // string color grey
        rtSettings.SetTextColComment(RGB(0,128,0));         // comment color dark green
        rtSettings.SetCommentStart1(_T("(*"));              // comments start with (*
        rtSettings.SetCommentEnd1(_T("*)"));                // comments end with *)
        rtSettings.SetKeepTabs(TRUE);                       // tabs are not converted to spaces
        rtSettings.SetShowTabs(FALSE);                      // tabs are not visualized
        rtSettings.SetTabSize(4);                           // tab is as wide as 4 spaces
        rtSettings.SetKeywordFile(_T("stkeywords.ini"));    // set keyword ini file
    }
    else    // any other extension
    {
        rtSettings.SetChroma(FALSE);                        // coloring disabled
        rtSettings.SetBackgroundCol(RGB(255,255,255));      // background color white
        rtSettings.SetTextColDefault(RGB(0,0,0));           // text color black
        rtSettings.SetKeepTabs(TRUE);                       // tabs are not converted to spaces
        rtSettings.SetShowTabs(FALSE);                      // tabs are not visualized
        rtSettings.SetTabSize(4);                           // tab is as wide as 4 spaces
    }
}
Esempio n. 14
0
BOOL CVisualManager::OnNcPaint (CWnd* pWnd, const CObList& lstSysButtons, CRect rectRedraw)
{
	if (!CanDrawImage ())
	{
		return CBCGPWinXPVisualManager::OnNcPaint (pWnd, lstSysButtons, rectRedraw);
	}

	ASSERT_VALID (pWnd);

	if (pWnd->GetSafeHwnd () == NULL)
	{
		return FALSE;
	}

	CWindowDC dc (pWnd);

	if (dc.GetSafeHdc () != NULL)
	{
		CRgn rgn;
		if (!rectRedraw.IsRectEmpty ())
		{
			rgn.CreateRectRgnIndirect (rectRedraw);
			dc.SelectClipRgn (&rgn);
		}

		CRect rtWindow;
		pWnd->GetWindowRect (rtWindow);
		pWnd->ScreenToClient (rtWindow);

		CRect rtClient;
		pWnd->GetClientRect (rtClient);

		rtClient.OffsetRect (-rtWindow.TopLeft ());
		dc.ExcludeClipRect (rtClient);

		rtWindow.OffsetRect (-rtWindow.TopLeft ());

        BOOL bActive = IsWindowActive (pWnd);

		CRect rectCaption (rtWindow);
		CSize szSysBorder (GetSystemBorders ());

		rectCaption.bottom = rectCaption.top + szSysBorder.cy;

		const DWORD dwStyle = pWnd->GetStyle ();
		BOOL bMaximized = (dwStyle & WS_MAXIMIZE) == WS_MAXIMIZE;

		const int nSysCaptionHeight = ::GetSystemMetrics (SM_CYCAPTION);
		rectCaption.bottom += nSysCaptionHeight;

		const DWORD dwStyleEx = pWnd->GetExStyle ();

		BOOL bDestroyIcon = FALSE;
		HICON hIcon = globalUtils.GetWndIcon (pWnd, &bDestroyIcon);

		CString strText;
		pWnd->GetWindowText (strText);

		CString strTitle (strText);
		CString strDocument;

		BOOL bPrefix = FALSE;
		if ((dwStyle & FWS_ADDTOTITLE) == FWS_ADDTOTITLE)
		{
			bPrefix = (dwStyle & FWS_PREFIXTITLE) == FWS_PREFIXTITLE;
			CFrameWnd* pFrameWnd = DYNAMIC_DOWNCAST(CFrameWnd, pWnd);

			if (pFrameWnd != NULL)
			{
				strTitle = pFrameWnd->GetTitle();

				if (!strTitle.IsEmpty ())
				{
					if (strText.GetLength () >= strTitle.GetLength ())
					{
						if (bPrefix)
						{
							int pos = strText.Find (strTitle, strText.GetLength () - strTitle.GetLength ());
							if (pos != -1)
							{
								strTitle = strText.Right (strTitle.GetLength () + 3);
								strDocument = strText.Left (strText.GetLength () - strTitle.GetLength ());
							}
						}
						else
						{
							int pos = strText.Find (strTitle);
							if (pos != -1)
							{
								strTitle = strText.Left (strTitle.GetLength () + 3);
								strDocument = strText.Right (strText.GetLength () - strTitle.GetLength ());
							}	
						}
					}
				}
				else
				{
					strDocument = strText;
				}
			}
		}

		if (bMaximized)
		{
			rectCaption.InflateRect (szSysBorder.cx, szSysBorder.cy, szSysBorder.cx, 0);
		}

		DrawNcCaption (&dc, rectCaption, dwStyle, dwStyleEx, 
						strTitle, strDocument, hIcon, bPrefix, bActive, FALSE,
						lstSysButtons);

		if (bDestroyIcon)
		{
			::DestroyIcon (hIcon);
		}

		if (bMaximized)
		{
			return TRUE;
		}

		rtWindow.top = rectCaption.bottom;

		dc.ExcludeClipRect (rectCaption);

		int indexBorder = 0;
		int indexNavi   = IsLargeNaviControl () ? 1 : 0;

		CRect rtPart (rtWindow);
		rtPart.right  = rtPart.left + szSysBorder.cx;
		rtPart.bottom = rtPart.top + 
			m_ctrlMainBorderExplorerL.GetParams ().m_rectImage.Height ();
		m_ctrlMainBorderExplorerL.Draw (&dc, rtPart, indexBorder);
		rtPart.top = rtPart.bottom;
		rtPart.bottom = rtWindow.bottom - 
			(m_ctrlMainBorderNaviL[indexNavi].GetParams ().m_rectImage.Height () + 
			 m_ctrlMainBorderNaviB[indexNavi].GetParams ().m_rectImage.Height ());
		m_ctrlMainBorderL.Draw (&dc, rtPart, indexBorder);
		rtPart.top = rtPart.bottom;
		rtPart.bottom = rtWindow.bottom - m_ctrlMainBorderNaviB[indexNavi].GetParams ().m_rectImage.Height ();
		m_ctrlMainBorderNaviL[indexNavi].Draw (&dc, rtPart, indexBorder);

		rtPart = rtWindow;
		rtPart.left   = rtPart.right - szSysBorder.cx;
		rtPart.bottom = rtPart.top + 
			m_ctrlMainBorderExplorerR.GetParams ().m_rectImage.Height ();
		m_ctrlMainBorderExplorerR.Draw (&dc, rtPart, indexBorder);
		rtPart.top = rtPart.bottom;
		rtPart.bottom = rtWindow.bottom - 
			(m_ctrlMainBorderNaviR[indexNavi].GetParams ().m_rectImage.Height () + 
			 m_ctrlMainBorderNaviB[indexNavi].GetParams ().m_rectImage.Height ());
		m_ctrlMainBorderR.Draw (&dc, rtPart, indexBorder);
		rtPart.top = rtPart.bottom;
		rtPart.bottom = rtWindow.bottom - m_ctrlMainBorderNaviB[indexNavi].GetParams ().m_rectImage.Height ();
		m_ctrlMainBorderNaviR[indexNavi].Draw (&dc, rtPart, indexBorder);

		rtPart = rtWindow;
		rtPart.top = rtPart.bottom - m_ctrlMainBorderNaviB[indexNavi].GetParams ().m_rectImage.Height ();
		m_ctrlMainBorderNaviB[indexNavi].Draw (&dc, rtPart, indexBorder);

		if (indexNavi == 1)
		{
			m_ctrlMainBorderNaviBCtrl.DrawEx (&dc, rtPart, 0, CBCGPToolBarImages::ImageAlignHorzCenter, CBCGPToolBarImages::ImageAlignVertBottom);
		}

		dc.SelectClipRgn (NULL);

		return TRUE;
	}

	return CBCGPWinXPVisualManager::OnNcPaint (pWnd, lstSysButtons, rectRedraw);
}
Esempio n. 15
0
void gxEditCell::OnChar (UINT nChar, UINT nRepCnt, UINT nFlags) 
{
    BOOL Shift = GetKeyState (VK_SHIFT) < 0;
    switch (nChar)
    {
		case VK_ESCAPE :
		{
			if (nChar == VK_ESCAPE)
				bEscape = TRUE;
			GetParent()->SetFocus();
			return;
		}
		case VK_RETURN :
		{
			SetListText();
			pListCtrl->EditSubItem (Item + 1, 0);
			return;
		}
		case VK_TAB :
		{
	/*		if (Shift)
			{
				if (SubItem > 0)
					pListCtrl->EditSubItem (Item, SubItem - 1);
				else
				{
					if (Item > 0)
						pListCtrl->EditSubItem (Item - 1, 2);
				}
			}
			else
			{
				if (SubItem < 2)
					pListCtrl->EditSubItem (Item, SubItem + 1);
				else
					pListCtrl->EditSubItem (Item + 1, 0);
			}*/
			return;
		}
    }

    CEdit::OnChar (nChar, nRepCnt, nFlags);

    // Resize edit control if needed

    // Get text extent
    CString Text;

    GetWindowText (Text);
    CWindowDC DC (this);
    CFont *pFont = GetParent()->GetFont();
    CFont *pFontDC = DC.SelectObject (pFont);
    CSize Size = DC.GetTextExtent (Text);
    DC.SelectObject (pFontDC);
    Size.cx += 5;			   	// add some extra buffer

    // Get client rect
    CRect Rect, ParentRect;
    GetClientRect (&Rect);
    GetParent()->GetClientRect (&ParentRect);

    // Transform rect to parent coordinates
    ClientToScreen (&Rect);
    GetParent()->ScreenToClient (&Rect);

    // Check whether control needs to be resized and whether there is space to grow
    if (Size.cx > Rect.Width())
    {
		if (Size.cx + Rect.left < ParentRect.right )
			Rect.right = Rect.left + Size.cx;
		else
			Rect.right = ParentRect.right;
		MoveWindow (&Rect);
    }
}
Esempio n. 16
0
//*****************************************************************************
BOOL CMacStyle::OnNcPaint (CWnd* pWnd, const CObList& lstSysButtons, CRect rectRedraw)
{
	ASSERT_VALID (pWnd);

	if (pWnd->GetSafeHwnd () == NULL)
	{
		return FALSE;
	}

	CWindowDC dc (pWnd);

	if (dc.GetSafeHdc () != NULL)
	{
		CRgn rgn;
		if (!rectRedraw.IsRectEmpty ())
		{
			rgn.CreateRectRgnIndirect (rectRedraw);
			dc.SelectClipRgn (&rgn);
		}

		CRect rtWindow;
		pWnd->GetWindowRect (rtWindow);
		pWnd->ScreenToClient (rtWindow);

		CRect rtClient;
		pWnd->GetClientRect (rtClient);

		rtClient.OffsetRect (-rtWindow.TopLeft ());
		dc.ExcludeClipRect (rtClient);

		rtWindow.OffsetRect (-rtWindow.TopLeft ());

		CRect rectCaption (rtWindow);
		CSize szSysBorder (GetSystemBorders ());

		rectCaption.bottom = rectCaption.top + szSysBorder.cy;

		const int nSysCaptionHeight = ::GetSystemMetrics (SM_CYCAPTION);
		rectCaption.bottom += nSysCaptionHeight;

		const DWORD dwStyle   = pWnd->GetStyle ();
		const DWORD dwStyleEx = pWnd->GetExStyle ();

		HICON hIcon = globalUtils.GetWndIcon (pWnd);

		CString strTitle;
		pWnd->GetWindowText (strTitle);

		DrawNcCaption (&dc, rectCaption, dwStyle, dwStyleEx, 
						strTitle, hIcon, m_bActive, TRUE,
						lstSysButtons);

		rtWindow.top = rectCaption.bottom;

		dc.ExcludeClipRect (rectCaption);
		m_ctrlMainBorder.DrawFrame (&dc, rtWindow, m_bActive ? 0 : 1);

		//-------------------------------
		// Find status bar extended area:
		//-------------------------------
		CBCGPStatusBar* pStatusBar = DYNAMIC_DOWNCAST (
			CBCGPStatusBar, pWnd->GetDescendantWindow (AFX_IDW_STATUS_BAR, TRUE));

		if (pStatusBar->GetSafeHwnd () != NULL && pStatusBar->IsWindowVisible ())
		{
			CRect rectStatus;
			pStatusBar->GetClientRect (rectStatus);

			int nHeight = rectStatus.Height ();
			rectStatus.bottom = rtWindow.bottom;
			rectStatus.top    = rectStatus.bottom - nHeight - szSysBorder.cy;
			rectStatus.left   = rtWindow.left;
			rectStatus.right  = rtWindow.right;

			m_ctrlStatusBarBack.Draw (&dc, rectStatus, m_bActive ? 0 : 1);
		}

		dc.SelectClipRgn (NULL);
		return TRUE;
	}

	return CBCGPVisualManagerXP::OnNcPaint (pWnd, lstSysButtons, rectRedraw);
}
Esempio n. 17
0
/*func*------------------------------------------------------------------------
  description:
  in :
  out:
-----------------------------------------------------------------------------*/
BOOL CGrEditorApp::InitInstance()
{
	HRESULT hr;
	HFONT hFont;
	LOGFONT logFont;
	CGdiObject *pGdiObject;
	USES_CONVERSION;

   // Initialize OLE libraries
	if (!AfxOleInit())
	{
		AfxMessageBox(IDP_GR_OLE_INIT_FAILED);
		return FALSE;
	}
	hr = ::CoInitializeSecurity (NULL, -1, NULL, NULL,
	                             RPC_C_AUTHN_LEVEL_NONE, 
	                             RPC_C_IMP_LEVEL_IMPERSONATE, 
	                             NULL, EOAC_NONE, NULL);
	assert (SUCCEEDED (hr));    

   // prevent the Server-Busy dialog
   COleMessageFilter *pFilter = AfxOleGetMessageFilter();
   assert (pFilter);
   if (pFilter != NULL)
   {
      pFilter->EnableNotRespondingDialog(FALSE);
      pFilter->EnableBusyDialog(FALSE);
   }

	AfxEnableControlContainer();

	// Standard initialization
	// If you are not using these features and wish to reduce the size
	//  of your final executable, you should remove from the following
	//  the specific initialization routines you do not need.

#ifdef _AFXDLL
	Enable3dControls();			// Call this when using MFC in a shared DLL
#else
	Enable3dControlsStatic();	// Call this when linking to MFC statically
#endif

	_Module.Init (ObjectMap, m_hInstance);

	// Change the registry key under which our settings are stored.
	// TODO: You should modify this string to be something appropriate
	// such as the name of your company or organization.

	SetRegistryKey (_T ("Softing\\4CONTROLV2\\4CONTROL Engineering"));

   int     iValue;
   CString strKey, strSec;
   strSec.LoadString(IDS_GR_REG_SECTION);

   strKey.LoadString(IDS_GR_REG_RUBBLINE);
	iValue = GetProfileInt ((LPCTSTR)strSec, (LPCTSTR)strKey, 0);
          WriteProfileInt ((LPCTSTR)strSec, (LPCTSTR)strKey, iValue );   // set Line draw mode to rubberlines

   strKey.LoadString(IDS_GR_REG_RUBB_RECON);
	iValue = GetProfileInt ((LPCTSTR)strSec, (LPCTSTR)strKey, 1);
          WriteProfileInt ((LPCTSTR)strSec, (LPCTSTR)strKey, iValue );   // set Line draw mode to rubberlines

   strKey.LoadString(IDS_GR_REG_ZOOMVALUE);
	iValue = GetProfileInt ((LPCTSTR)strSec, (LPCTSTR)strKey, 100);
          WriteProfileInt ((LPCTSTR)strSec, (LPCTSTR)strKey, iValue );   // set zoom factor for 4gr

   // default sizes for element insertion
   strKey.LoadString(IDS_GR_REG_STEPSIZE);
	iValue = GetProfileInt ((LPCTSTR)strSec, (LPCTSTR)strKey, (4<<16)+4); // <0: AutoSize:on; HiWord:X; LoWord:Y
          WriteProfileInt ((LPCTSTR)strSec, (LPCTSTR)strKey, iValue );

    // ST actions we yes the STEditor settings ..
	WriteProfileInt    (_T ("ST"), _T ("Case"           ), 0                    );   // keywords are case insensitive
	WriteProfileInt    (_T ("ST"), _T ("Chroma"         ), 1                    );   // coloring enabled
	WriteProfileString (_T ("ST"), _T ("Background"     ), _T ("255,255,255"   ));   // background color white
	WriteProfileString (_T ("ST"), _T ("Default Text"   ), _T ("0,0,0"         ));   // text color black
	WriteProfileString (_T ("ST"), _T ("Quote"          ), _T ("128,128,128"   ));   // string color grey
	WriteProfileString (_T ("ST"), _T ("Comment"        ), _T ("0,128,0"       ));   // comment color red
	WriteProfileString (_T ("ST"), _T ("Comment Start 1"), _T ("(*"            ));   // comments start with (*
	WriteProfileString (_T ("ST"), _T ("Comment End 1"  ), _T ("*)"            ));   // comments end with *)
	WriteProfileInt    (_T ("ST"), _T ("Keep Tabs"      ), 0                    );   // tabs are not converted to spaces
	WriteProfileInt    (_T ("ST"), _T ("Show Tabs"      ), 0                    );   // tabs are not visualized
	WriteProfileInt    (_T ("ST"), _T ("Tab Size"       ), 4                    );   // tab is as wide as 4 spaces
	WriteProfileString (_T ("ST"), _T ("Keywords"       ), _T ("stkeywords.ini"));   //

	// sizeof (LOGFONT) gives you the maximum size of a LOGFONT structure.
	// CGdiObject::GetObject possibly returns less because the font name
	// at the end of the LOGFONT structure may not take the whole space
	// reserved for it.
	hFont = (HFONT)GetStockObject (ANSI_FIXED_FONT);
	pGdiObject = CGdiObject::FromHandle (hFont);
	if (pGdiObject != NULL && pGdiObject->GetObject (sizeof (LOGFONT), &logFont) != 0)
	{
		int iFontSize;
		CWindowDC dc (m_pMainWnd);

		WriteProfileString (_T ("ST"), _T ("Font Name"), A2T (logFont.lfFaceName));
		iFontSize = MulDiv (logFont.lfHeight, 72, dc.GetDeviceCaps (LOGPIXELSY));
		WriteProfileInt (_T ("ST"), _T ("Font Size"), iFontSize);
		WriteProfileInt (_T ("ST"), _T ("Font Weight"), logFont.lfWeight);
		WriteProfileInt (_T ("ST"), _T ("Font Italic"), logFont.lfItalic);
		WriteProfileInt (_T ("ST"), _T ("CharSet"), logFont.lfCharSet);
	};

	LoadStdProfileSettings();  // Load standard INI file options (including MRU)

	// Register the application's document templates.  Document templates
	//  serve as the connection between documents, frame windows and views.

	m_pDocTemplate = new CMultiDocTemplate(
		IDR_GR_TYPE,
		RUNTIME_CLASS(CGrEditorDoc),
		RUNTIME_CLASS(CChildFrame), // custom MDI child frame
		RUNTIME_CLASS(CGrEditorView));
	m_pDocTemplate->SetServerInfo(
		IDR_GR_TYPE_SRVR_EMB, IDR_GR_TYPE_SRVR_IP,
		RUNTIME_CLASS(CInPlaceFrame));
	AddDocTemplate(m_pDocTemplate);

	// Connect the COleTemplateServer to the document template.
	//  The COleTemplateServer creates new documents on behalf
	//  of requesting OLE containers by using information
	//  specified in the document template.
	m_server.ConnectTemplate(clsid, m_pDocTemplate, FALSE);

	// Register all OLE server factories as running.  This enables the
	//  OLE libraries to create objects from other applications.
	COleTemplateServer::RegisterAll();
		// Note: MDI applications register all server objects without regard
		//  to the /Embedding or /Automation on the command line.

	// create main MDI Frame window
	CMainFrame* pMainFrame = new CMainFrame;
	if (!pMainFrame->LoadFrame(IDR_GR_MAINFRAME))
		return FALSE;
	m_pMainWnd = pMainFrame;

   // create a dummy image .. to solve the problem with DeleteTempMap in OnIdle
   m_pDummyImage = new CImageList();
   VERIFY (m_pDummyImage->Create (16, 15, TRUE, 0, 1));      
   CBitmap bm;
   bm.LoadBitmap (IDR_GR_MAINFRAME);
   m_pDummyImage->Add (&bm, RGB (192, 192, 192));

	// Enable drag/drop open
	m_pMainWnd->DragAcceptFiles();

	// Enable DDE Execute open
	EnableShellOpen();
	RegisterShellFileTypes(TRUE);

	// Parse command line for standard shell commands, DDE, file open
	CSTCommandLineInfo cmdInfo;
	ParseCommandLine(cmdInfo);

	// Check to see if launched as OLE server
	if (cmdInfo.m_bRunEmbedded || cmdInfo.m_bRunAutomated)
	{
		// Application was run with /Embedding or /Automation.  Don't show the
		//  main window in this case.
		return TRUE;
	}

	// When a server application is launched stand-alone, it is a good idea
	//  to update the system registry in case it has been damaged.
	m_server.UpdateRegistry(OAT_DOC_OBJECT_SERVER);
	COleObjectFactory::UpdateRegistryAll();

	if (cmdInfo.m_bRegServer)
	{
		TCHAR szModule[_MAX_PATH+10];
		LPOLESTR pszModule;
		HRESULT hr;
		LPTYPELIB pTypeLib;
		USES_CONVERSION;

		::GetModuleFileName (m_hInstance, szModule, _MAX_PATH);
		pszModule = T2OLE (szModule);
		hr = LoadTypeLib (pszModule, &pTypeLib);
		if (SUCCEEDED (hr))
		{
			hr = RegisterTypeLib (pTypeLib, pszModule, NULL);
			pTypeLib->Release ();
		};

		return (FALSE);
	};

   // Prevents ProcessShellCommand from displaying
   // a message box when unregistering.
   if (cmdInfo.m_nShellCommand == CCommandLineInfo::AppUnregister)
   {
      cmdInfo.m_bRunEmbedded = true;
   };
	
   // Dispatch commands specified on the command line
	if (!ProcessShellCommand(cmdInfo))
		return FALSE;

	// The main window has been initialized, so show and update it.
	pMainFrame->ShowWindow(m_nCmdShow);
	pMainFrame->UpdateWindow();

	return TRUE;
}