Click here to Skip to main content
15,893,381 members
Articles / Programming Languages / C#

A Managed C++ Wrapper Around the Windows XP Theme API

Rate me:
Please Sign up or sign in to vote.
4.97/5 (31 votes)
27 Aug 2003CPOL5 min read 308.6K   5.5K   72  
Using the XP Theme API safely on any OS from C#
#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 PropTable::s_PropTableStart = -1;

PropTable::PropTable(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 );
}

PropTable::~PropTable(void)
{
}


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

const wchar_t* PropTable::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
Team Leader Starkey Laboratories
United States United States
The first computer program I ever wrote was in BASIC on a TRS-80 Model I and it looked something like:
10 PRINT "Don is cool"
20 GOTO 10

It only went downhill from there.

Hey look, I've got a blog

Comments and Discussions