Click here to Skip to main content
15,886,362 members
Articles / Desktop Programming / ATL

Classic Shell

Rate me:
Please Sign up or sign in to vote.
4.99/5 (135 votes)
23 Feb 2010MIT33 min read 956.3K   10K   195  
Classic Start menu and other shell features for Windows 7 and Vista.
// Classic Shell (c) 2009-2010, Ivo Beltchev
// The sources for Classic Shell are distributed under the MIT open source license

#pragma once

#include <windows.h>
#include <vector>

///////////////////////////////////////////////////////////////////////////////

class CSettingsParser
{
public:
	// Reads a file into m_Text
	bool LoadText( const wchar_t *fname );
	// Reads a text resource into m_Text
	bool LoadText( HMODULE hMod, HRSRC hResInfo );

	// Splits m_Text into m_Lines
	void ParseText( void );

	// Filters the settings that belong to the given language
	// lanugages is a 00-terminated list of language names ordered by priority
	void FilterLanguages( const wchar_t *languages );

	// Returns a setting with the given name. If no setting is found, returns def
	const wchar_t *FindSetting( const char *name, const wchar_t *def=NULL );
	const wchar_t *FindSetting( const wchar_t *name, const wchar_t *def=NULL );

	// Frees all resources
	virtual void Reset( void );

protected:
	std::vector<wchar_t> m_Text;
	std::vector<const wchar_t*> m_Lines;

private:
	const wchar_t *FindSetting( const wchar_t *name, size_t len );
	void LoadText( const unsigned char *buf, int size );
};

///////////////////////////////////////////////////////////////////////////////

class CSkinParser: public CSettingsParser
{
public:
	bool LoadVariation( const wchar_t *fname );
	bool LoadVariation( HMODULE hMod, HRSRC hResInfo );
	virtual void Reset( void );

protected:
	std::vector<wchar_t> m_VarText;
};

///////////////////////////////////////////////////////////////////////////////

const wchar_t *GetToken( const wchar_t *text, wchar_t *token, int size, const wchar_t *separators );

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 MIT License


Written By
Software Developer (Senior)
United States United States
Ivo started programming in 1985 on an Apple ][ clone. He graduated from Sofia University, Bulgaria with a MSCS degree. Ivo has been working as a professional programmer for over 12 years, and as a professional game programmer for over 10. He is currently employed in Pandemic Studios, a video game company in Los Angeles, California.

Comments and Discussions