|
#include "stdafx.h"
int main(int argc, char* argv[])
{
if( TRUE == OpenClipboard( NULL ) )
{
if( TRUE == IsClipboardFormatAvailable( CF_UNICODETEXT ) )
{
HGLOBAL hClipboardData = GetClipboardData( CF_UNICODETEXT );
if( NULL != hClipboardData )
{
LPWSTR pClipboardText = static_cast<LPWSTR>
( GlobalLock( hClipboardData ) );
if( NULL != pClipboardText )
{
wstring wide( pClipboardText );
GlobalUnlock( hClipboardData );
std::transform(wide.begin(), wide.end(), wide.begin(), toupper);
wcout << L"Wide Text: " << wide << endl;
}
}
}
if( TRUE == IsClipboardFormatAvailable( CF_TEXT ) )
{
HGLOBAL hClipboardData = GetClipboardData( CF_TEXT );
if( NULL != hClipboardData )
{
char* pClipboatdText = static_cast<LPSTR>
( GlobalLock( hClipboardData ) );
if( NULL != pClipboatdText )
{
string narrow( pClipboatdText );
GlobalUnlock( hClipboardData );
std::transform(narrow.begin(), narrow.end(), narrow.begin(), toupper);
cout << "Narrow Text: " << narrow << endl;
}
}
}
CloseClipboard( );
} // TRUE == OpenClipboard( )
return 0;
}
|
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 member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.