Click here to Skip to main content
15,886,518 members
Articles / Desktop Programming / MFC

Exile 1.8 - The Password Manager

Rate me:
Please Sign up or sign in to vote.
4.57/5 (51 votes)
6 Mar 20058 min read 255.3K   7.4K   111  
Yet another password manager.
// Title.cpp : implementation file
//

#include "stdafx.h"
#include "exile.h"
#include "Title.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CTitle

CTitle::CTitle()
{
	// Set up Title and Text font
    NONCLIENTMETRICS ncm = { 0 };

    ncm.cbSize = sizeof(ncm);
    SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0);

    LOGFONT lfTitle = ncm.lfMessageFont;
    lfTitle.lfWeight = FW_BOLD;

    HDC hDC = ::GetDC(NULL); // Gets the screen DC
    int FontSize = 14;

    lfTitle.lfHeight = FontSize;//0 - GetDeviceCaps(hDC, LOGPIXELSY) * FontSize / 72;

    m_hTitle = CreateFontIndirect(&lfTitle);

	lfTitle.lfWeight = FW_NORMAL;
	m_hText = CreateFontIndirect(&lfTitle);

    ::ReleaseDC(NULL, hDC);
}

CTitle::~CTitle()
{
	::DeleteObject(m_hText);
	::DeleteObject(m_hTitle);
}


BEGIN_MESSAGE_MAP(CTitle, CStatic)
	//{{AFX_MSG_MAP(CTitle)
	ON_WM_ERASEBKGND()
	ON_WM_PAINT()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CTitle message handlers

BOOL CTitle::OnEraseBkgnd(CDC* pDC) 
{
	return CStatic::OnEraseBkgnd(pDC);
}

void CTitle::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	CRect rc;

	GetClientRect(rc);

	CBrush brWhite;
	brWhite.CreateSolidBrush(RGB(255, 255, 255));

	FillRect(dc, rc, brWhite);

	HFONT hOld = (HFONT)::SelectObject(dc, m_hTitle);

	TextOut(dc, 20, 20, m_strTitle, m_strTitle.GetLength());

	::SelectObject(dc, m_hText);

	TextOut(dc, 50, 40, m_strText, m_strText.GetLength());
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
Russian Federation Russian Federation
I'll think about it later on...

Comments and Discussions