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

Internet Explorer AdBlock

, 17 Jan 2008 GPL3
Internet Explorer AdBlock Add-on
ieadblock_src.zip
IE AdBlockPS
IE AdBlockps.def
IE AdBlock
AdBlockBand.rgs
AdBlockBHO.rgs
bin
XListCtrlSSDU.lib
XListCtrlSSRU.lib
IE AdBlock.def
IE AdBlock.rgs
res
bmpToolbar.bmp
checkboxes.bmp
icoSettings.ico
XListCtrl
checkboxes.bmp
// XThemeHelper.h  Version 1.1
//
// Author:  Hans Dietrich
//          hdietrich@gmail.com
//
// This software is released into the public domain.  You are free to use
// it in any way you like, except that you may not sell this source code.
//
// This software is provided "as is" with no expressed or implied warranty.
// I accept no liability for any damage or loss of business that this
// software may cause.
//
///////////////////////////////////////////////////////////////////////////////

#ifndef  XTHEMEHELPER_H
#define  XTHEMEHELPER_H

#include "uxtheme.h"
#include "tmschema.h"


///////////////////////////////////////////////////////////////////////////////
//
// typedefs for uxtheme functions
//
typedef HRESULT	(__stdcall *PFNCLOSETHEMEDATA)(HTHEME hTheme);
typedef HRESULT	(__stdcall *PFNDRAWTHEMEBACKGROUND)(HTHEME hTheme, HDC hdc,
								int iPartId, int iStateId,
								const RECT *pRect,  const RECT *pClipRect);
typedef HRESULT	(__stdcall *PFNDRAWTHEMETEXT)(HTHEME hTheme, HDC hdc,
								int iPartId, int iStateId, LPCWSTR pszText,
								int iCharCount, DWORD dwTextFlags,
								DWORD dwTextFlags2, const RECT *pRect);
typedef HRESULT	(__stdcall *PFNGETTHEMEBACKGROUNDCONTENTRECT)(HTHEME hTheme,
								HDC hdc, int iPartId, int iStateId,
								const RECT *pBoundingRect,
								RECT *pContentRect);
typedef HRESULT	(__stdcall *PFNGETTHEMECOLOR)(HTHEME hTheme,
								int iPartId, int iStateId, int iPropId,
								COLORREF * pColor);
typedef BOOL	(__stdcall *PFNISAPPTHEMED)();
typedef BOOL	(__stdcall *PFNISTHEMEACTIVE)();
typedef HTHEME	(__stdcall *PFNOPENTHEMEDATA)(HWND hwnd,
								LPCWSTR pszClassList);


///////////////////////////////////////////////////////////////////////////////
//
// CXThemeHelper class definition
//
class CXThemeHelper
{
// Construction
public:
	CXThemeHelper();
	virtual ~CXThemeHelper();

// Attributes
public:
	BOOL IsAppThemed();
	BOOL IsThemeActive();
	BOOL IsThemeLibAvailable() { return m_bThemeLibLoaded; }

// Operations
public:
	BOOL	CloseThemeData(HTHEME hTheme);
	BOOL	DrawThemeBackground(HTHEME hTheme,
								HDC hdc,
								int iPartId,
								int iStateId,
								const RECT *pRect,
								const RECT *pClipRect);
	BOOL	DrawThemeText(HTHEME hTheme,
						  HDC hdc,
						  int iPartId,
						  int iStateId,
						  LPCTSTR lpszText,
						  DWORD dwTextFlags,
						  DWORD dwTextFlags2,
						  const RECT *pRect);
	BOOL	GetThemeBackgroundContentRect(HTHEME hTheme,
										  HDC hdc,
										  int iPartId,
										  int iStateId,
										  const RECT *pBoundingRect,
										  RECT *pContentRect);
	BOOL CXThemeHelper::GetThemeColor(HTHEME hTheme,
									  int iPartId,
									  int iStateId,
									  int iPropId,
									  COLORREF * pColor);
	HTHEME	OpenThemeData(HWND hWnd, LPCTSTR lpszClassList);

// Implementation
private:
	static PFNCLOSETHEMEDATA				m_CloseThemeData;
	static PFNDRAWTHEMEBACKGROUND			m_DrawThemeBackground;
	static PFNDRAWTHEMETEXT					m_DrawThemeText;
	static PFNGETTHEMEBACKGROUNDCONTENTRECT	m_GetThemeBackgroundContentRect;
	static PFNGETTHEMECOLOR					m_GetThemeColor;
	static PFNISAPPTHEMED					m_IsAppThemed;
	static PFNISTHEMEACTIVE					m_IsThemeActive;
	static PFNOPENTHEMEDATA					m_OpenThemeData;

	static HMODULE							m_hThemeLib;
	static BOOL								m_bThemeLibLoaded;

	static int								m_nUseCount;

	void	Init();
};

///////////////////////////////////////////////////////////////////////////////
//
// CXThemeHelper instance
//
#ifndef XTHEMEHELPER_CPP
// include an instance in each file;  the namespace insures uniqueness
namespace { CXThemeHelper ThemeHelper; }
#endif

#endif // XTHEMEHELPER_H

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 GNU General Public License (GPLv3)

Share

About the Author

Geert van Horrik
Software Developer CatenaLogic
Netherlands Netherlands
I am Geert van Horrik, and I have studied Computer Science in the Netherlands.
 
I love to write software using .NET (especially the combination of WPF and C#). I am also the lead developer of Catel, an open-source application development framework for WPF, Silverlight, WP7 and WinRT with the focus on MVVM.
 
I have my own company since January 1st 2007, called CatenaLogic. This company develops commercial and non-commercial software.
 
To download (or buy) applications I have written, visit my website: http://www.catenalogic.com
Follow on   Twitter

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.150128.1 | Last Updated 17 Jan 2008
Article Copyright 2008 by Geert van Horrik
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid