Click here to Skip to main content
15,879,053 members
Articles / Desktop Programming / WTL

Boost.Range support for ATL/WTL CString

Rate me:
Please Sign up or sign in to vote.
4.12/5 (9 votes)
2 Sep 20052 min read 36K   262   11  
Consistent interfaces to CString using Boost.Range.
#pragma once

#include <boost/range/begin.hpp>
#include <boost/range/empty.hpp>
#include <boost/range/size.hpp>
#include "../diagnostic/is_valid.hpp"
#include "../diagnostic/is_valid_string_buffer_range.hpp"
#include "../diagnostic/verify.hpp"

namespace tomato {

template< class BufferRange >
inline int fill_window_text(HWND hWnd, BufferRange& buf)
{
	ATLASSERT(is_valid(hWnd));
	ATLASSERT(is_valid_string_buffer_range(buf));
	ATLASSERT(!boost::empty(buf)); // api document tells nothing

	// ::GetWindowText doesn't say whether failed or has empty title.
	return ::GetWindowText(hWnd, boost::begin(buf), boost::size(buf));
}

} // namespace tomato

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 has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Japan Japan
I am worried about my poor English...

Comments and Discussions