Click here to Skip to main content
12,753,195 members (39,293 online)
Click here to Skip to main content


81 bookmarked
Posted 18 Sep 2002

Shell Extensions for .NET Assemblies

, 17 Nov 2005 Ms-PL
Shell extensions to distinguish between .NET assemblies and Win32 applications and libraries.
// Resources.h : Resource management and related classes.

#pragma once

#include "stdafx.h"
#include <map>
#include <windows.h>

class CCriticalSection

	// Default to the high-order WORD set, which on Win2K
	// pre-allocates the critical section. Default spin
	// count to 1024.

	// Pre-allocate a new critical section, using the spin
	// count to wait until the critical section can be created.
	CCriticalSection(DWORD dwSpinCount) :
		if (!InitializeCriticalSectionAndSpinCount(&m_cs, dwSpinCount))

	// Delete the critical section.
	~CCriticalSection() throw()
		// It is the caller's responsibility to call
		// unlock enough times from the owning thread
		// before this object is destroyed.

	// Lock the critical section in the calling thread. This
	// will block if it is owned by one thread and attempting
	// to be locked by others.
	void Lock() throw()

	// Unlock the critical section by the owning calling thread.
	// Unlock should be called an equal number of times as Lock.
	// See get_LockCount to determine how many times to unlock.
	void Unlock() throw()
		// Don't unlock more times than we've locked.
		if (m_uiLockCount)

	// Gets the net number of times Lock and Unlock were called.
	UINT get_LockCount()
		return m_uiLockCount;


	UINT m_uiLockCount;

// TODO: Finish System.Resources.ResourceManager-like implementation.
class CResources

	CResources() throw();
	LANGID GetCurrentUILanguage() throw();
	UINT LoadString(UINT uID, LPTSTR pszBuffer, UINT cchBuffer);


	std::map<LCID, HINSTANCE> m_ResourceInstances;
	CCriticalSection m_cs;

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.


This article, along with any associated source code and files, is licensed under The Microsoft Public License (Ms-PL)


About the Author

Heath Stewart
Software Developer Microsoft
United States United States
Heath Stewart is a happily married software engineer originally from the Midwest and a graduate of Iowa State University. Heath start programming early in life and enjoys continuous research and development in new languages, frameworks, and platforms. Fluent in many different programming languages, he has developed many large-scale software solutions for companies in different areas, such as Internet filtering, intrusion detection systems, production management systems, and web applications for various purposes. He also enjoys photography.

Currently, Heath is a Program Manager in the Visual Studio Professional Deployment Experience (VSPro DEX) team at Microsoft. Previous to his employment, he was a Microsoft MVP for Visual C#.

He is also a CodeProject protector and is happy to help the development community.

You may also be interested in...

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170217.1 | Last Updated 17 Nov 2005
Article Copyright 2002 by Heath Stewart
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid