Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

CKCSideBannerWnd: An MFC Banner Control that Can Add a Professional-looking Feel to Most Windows...

, 6 Nov 2003 CPOL
A CWnd-derived control that can attach itself to any window, without the programmer making provisions for it
kcsidebannerwnd_demo.zip
SideBanner
Release
SideBanner.exe
res
ico00001.ico
icon1.ico
texture.bmp
SideBanner.clw
SideBanner.dsp
SideBanner.dsw
/****************************************************************************
 *	class		:	CWndUtil
 *	author		:	Peter Mares / kinkycode.com (gui@kinkycode.com)
 *	base class	:	none
 *	notes		:	Helper class for custom CWnd registration (Should derived from here)
 *
 *	Blurb		:	Its free, it feels good and its from South Africa :)
 ****************************************************************************
 *	Version History:
 *
 *	v0.1 (2003-05-10)
 *
 *	- First public release
 *
 ****************************************************************************/

#if !defined(AFX_WNDUTIL_H__979E2102_DC7C_461D_AA76_40F06C0FBF87__INCLUDED_)
#define AFX_WNDUTIL_H__979E2102_DC7C_461D_AA76_40F06C0FBF87__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

class CWndUtil  
{
protected:
	CWndUtil(LPCTSTR lpszClassName)
		: m_strClassName(lpszClassName)
	{
	}

	virtual ~CWndUtil()
	{
	}

public:

	virtual BOOL			RegisterWndClass()
	{
		WNDCLASS			wnd;
		HINSTANCE			hInst = AfxGetInstanceHandle();

		if ( !(::GetClassInfo( hInst, m_strClassName, &wnd )) )
		{
			wnd.style				= CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW;
			wnd.lpfnWndProc			= ::DefWindowProc;
			wnd.cbClsExtra			= wnd.cbWndExtra = 0;
			wnd.hInstance			= hInst;
			wnd.hIcon				= NULL;
			wnd.hCursor				= AfxGetApp()->LoadStandardCursor(IDC_ARROW);
			wnd.hbrBackground		= NULL;
			wnd.lpszMenuName		= NULL;
			wnd.lpszClassName		= m_strClassName;

			if ( !AfxRegisterClass(&wnd) )
			{
				AfxThrowResourceException();
				return FALSE;
			}
		}

		return TRUE;
	}

protected:
	// class registration/information
	CString					m_strClassName;
};

#endif // !defined(AFX_WNDUTIL_H__979E2102_DC7C_461D_AA76_40F06C0FBF87__INCLUDED_)

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)

Share

About the Author

Peter Mares
Architect
Ireland Ireland
Peter Mares has no comment on himself. I'll let the objective humanoids do the damage Wink | ;)
He is currently developing a hobby MMO to prove that he can do it Wink | ;)

My Blog

All good things were meant to be improved
Follow on   Twitter

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.141220.1 | Last Updated 7 Nov 2003
Article Copyright 2003 by Peter Mares
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid