Click here to Skip to main content
15,882,017 members
Articles / Mobile Apps / Windows Mobile

Wifi scanner + custom MFC controls

Rate me:
Please Sign up or sign in to vote.
4.78/5 (29 votes)
30 Jul 2007CPOL16 min read 234K   10.2K   146  
A Wifi scanner with custom slider, tab control, buttons and checkboxes
// ColoredDlg.cpp : implementation file
//

#include "stdafx.h"
#include "ColoredDlg.h"

// CColoredDlg dialog

IMPLEMENT_DYNAMIC(CColoredDlg, CDialog)

CColoredDlg::CColoredDlg(CWnd* pParent /*=NULL*/)
//	: CDialog(CColoredDlg::IDD, pParent)
{
	//default brush
	m_brBkg.CreateSolidBrush(RGB_AVERAGE(GetSysColor(COLOR_ACTIVECAPTION), RGB(255, 255, 255)));
}

CColoredDlg::CColoredDlg(UINT nDialogID, CWnd* pParent /* = NULL */)
{
	m_pParentWnd = pParent;
	m_lpszTemplateName = MAKEINTRESOURCE(nDialogID);
	m_nIDHelp = nDialogID;
	//default brush
	m_brBkg.CreateSolidBrush(RGB_AVERAGE(GetSysColor(COLOR_ACTIVECAPTION), RGB(255, 255, 255)));
}

CColoredDlg::~CColoredDlg()
{
}

BEGIN_MESSAGE_MAP(CColoredDlg, CDialog)
	ON_WM_CTLCOLOR()
END_MESSAGE_MAP()

// CColoredDlg message handlers
//////////////////////////////////////////////////////////////////////////
HBRUSH CColoredDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
	//we can set up the control's painting DC here.
	pDC->SetBkColor(m_crBkg);
	pDC->SetTextColor(m_crFrg);
	pDC->SetBkMode(OPAQUE);
	//and return a background brush
	return m_brBkg;
}

//////////////////////////////////////////////////////////////////////////
void CColoredDlg::SetBkgColor(COLORREF crBkg)
{
	m_crBkg=crBkg;
	//re-create bkg brush
	m_brBkg.DeleteObject();
	m_brBkg.CreateSolidBrush(crBkg);
}

//////////////////////////////////////////////////////////////////////////
void CColoredDlg::SetFrgColor(COLORREF crFrg)
{
	m_crFrg=crFrg;
}

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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
Hungary Hungary
I'm a 29-year old software developer. I began programming on a ZX Spectrum many years ago. I've programmed a number of high level languages (Basic, Pascal, C/C++, Java, Php, Perl, C#). I also like reverse-engineering and assembler programming.
I'm interested in handheld devices programming, especially Windows Mobile devices.

Comments and Discussions