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

A File Checksum Shell Menu Extension DLL

, 23 May 2008 LGPL3
Create a File Checksum Shell Menu Extension using ATL and Crypto++
ctxcreatehash.zip
CtxCreateHash
CtxCreateHash
CreateHash.rgs
CtxCreateHash.def
CtxCreateHash.rgs
CtxCreateHash.vcproj.8.00.old
CtxCreateHashps.def
CtxCreateHashPS.vcproj.8.00.old
CtxCreateHash.sln.old
ctxcreatehash2005.zip
CreateHash.rgs
CtxCreateHash.aps
CtxCreateHash.def
CtxCreateHash.rgs
CtxCreateHashps.def
ctxcreatehashdll.zip
CtxCreateHash.dll
ctxverifyhash.zip
CtxVerifyHash
CtxVerifyHash
CtxVerifyHash.def
CtxVerifyHash.rgs
CtxVerifyHash.vcproj.8.00.old
CtxVerifyHashps.def
CtxVerifyHashPS.vcproj.8.00.old
VerifyHash.rgs
CtxVerifyHash.sln.old
ctxverifyhash2005.zip
CtxVerifyHash.aps
CtxVerifyHash.def
CtxVerifyHash.rgs
CtxVerifyHashps.def
VerifyHash.rgs
ctxverifyhashdll.zip
CtxVerifyHash.dll
sample1.zip
Sample 1
Test 1.dsp
Test 1.dsw
sample2.zip
Sample 2
Test 2.dsp
Test 2.dsw
sample3.zip
Sample 3
Test 3.dsp
Test 3.dsw
sample4.zip
Sample 4
Test 4.dsp
Test 4.dsw
sample5.zip
Sample 5
CtxTest.def
CtxTest.dsp
CtxTest.dsw
CtxTestps.def
CtxTestps.mk
MenuItem.rgs
#include "stdafx.h"

#include <string>
#include <locale>

#include "StdStringHelper.h"

#pragma warning ( push, 4 )
// Courtesy of Tom Widmer (VC++ MVP)
std::string StringNarrow( const std::wstring& wide ) {

	typedef std::ctype<wchar_t> CT;

	std::string narrow;
    narrow.resize( wide.length() );

	CT const& ct = std::_USE(std::locale(), CT);

    // Non-Portable
	// ct.narrow( wide.begin(), wide.end(), '_', narrow.begin() );

    // Portable
    ct.narrow( &wide[0], &wide[0] + wide.size(), '_', &narrow[0] );

	return narrow;
}

// Courtesy of Tom Widmer (VC++ MVP)
std::wstring StringWiden( const std::string& narrow ) {

	typedef std::ctype<wchar_t> CT;

	std::wstring wide;
    wide.resize( narrow.length() );

	CT const& ct = std::_USE(std::locale(), CT);

    // Non Portable
	// ct.widen( narrow.begin(), narrow.end(), wide.begin() );

    // Portable
    ct.widen(&narrow[0], &narrow[0] + narrow.size(), &wide[0]);

	return wide;
}

// Wide Version
std::wstring StringUpper( const std::wstring& wide ) {

    std::wstring upper;
    upper.resize( wide.length() );

	std::transform(wide.begin(), wide.end(), upper.begin(), toupper);

	return upper;
}

// Narrow Version
std::string StringUpper( const std::string& narrow ) {

    std::string upper;
    upper.resize( narrow.length() );

	std::transform(narrow.begin(), narrow.end(), upper.begin(), toupper);

	return upper;
}

// Wide Version
std::wstring StringLower( const std::wstring& wide ) {

    std::wstring lower;
    lower.resize( wide.length() );

	std::transform(wide.begin(), wide.end(), lower.begin(), tolower);

	return lower;
}

// Narrow Version
std::string StringLower( const std::string& narrow ) {

    std::string lower;
    lower.resize( narrow.length() );

	std::transform(narrow.begin(), narrow.end(), lower.begin(), tolower);

	return lower;
}

#pragma warning ( pop )

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 Lesser General Public License (LGPLv3)

Share

About the Author

Jeffrey Walton
Systems / Hardware Administrator
United States United States
No Biography provided

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.1411028.1 | Last Updated 24 May 2008
Article Copyright 2006 by Jeffrey Walton
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid