Click here to Skip to main content
15,881,281 members
Articles / Desktop Programming / Win32

A Managed C++ Wrapper Around the Windows XP Theme API - Part 2

Rate me:
Please Sign up or sign in to vote.
4.83/5 (16 votes)
24 Apr 2008CPOL3 min read 71.7K   1K   27  
This is an update to Don Kackman's UxTheme component originally written for Visual Studio 2003
#include "StdAfx.h"
#include "proptable.h"
#using <mscorlib.dll>

#include <tmschema.h>

#define TMT_ENUMDEF 8
#define TMT_ENUMVAL TEXT('A')
#define TMT_ENUM	TEXT('B')

#define SCHEMA_STRINGS
#include <tmschema.h> 

using namespace System;

int CPropTable::s_PropTableStart = -1;

CPropTable::CPropTable(void)
{
	// the front part of the table contains a bunch of records that we don't use
	// The first time through this code finds the first window class record
	if ( s_PropTableStart == -1 )
	{
		const wchar_t szParts[] = L"PARTS";
		const TMPROPINFO* pPropTable = GetSchemaInfo()->pPropTable;
			
		int i = 0;

		//	Move past the items at the beginning of the file.
		while ( ( i < GetSchemaInfo()->iPropCount ) && ( !wcsstr( pPropTable[i].pszName, szParts ) ) )
			i++;
		
		// if we didn't spin through the whole table remmber the position
		if ( i < GetSchemaInfo()->iPropCount )
			s_PropTableStart = i;
	}

	MASSERT( s_PropTableStart != -1 );
}

CPropTable::~CPropTable(void)
{
}


int CPropTable::GetCount()
{
	return GetSchemaInfo()->iPropCount; 
}

const wchar_t* CPropTable::GetPropTableEntry( int index )
{
	MASSERT( index < GetSchemaInfo()->iPropCount );
	const TMPROPINFO* pPropTable = GetSchemaInfo()->pPropTable;

	return pPropTable[index].pszName;
}

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
Business Analyst Southwest Research Institute
United States United States
I am a C++ coder. I am also proficient with Oracle PL/SQL. A lot of folks dislike Oracle, but I find Oracle is a significant revenue enhancer. Customers pay for first rate Oracle programming skills.

I have extensive experience with COM+, COM, ATL, WTL and installation package development. I've developed several packages in C#, but I prefer managed/native C++. I've been coding for nearly thirty plus years, getting my start with atomic and molecular orbital calculations in FORTRAN. I've been working with C or C++ since the days of QuickC, Desmet C, Datalight C and MSC 5.1.

One of my pet peeves in life is a programmer's lack of attention to the details of error handling. Most example code I see on the internet lacks depth. No use of Window's Event Logging and a lack of understanding as to how to handle exceptions. If folks actually think about how to properly debug and test, there would be fewer "slop" articles and a lot higher quality.

Including instrumentation in your software to allow proper diagnosis of failures is far more important to a user than the latest Gee-Whiz-Bang visual effects. Graphical gotta-haves fade like the lettuce in a refrigerator, but solid programs just keep on running, no matter what environment they are placed in.

My Web Site, Blog & Wiki

Comments and Discussions