Stilllegung des Forums
Das Forum wurde am 05.06.2023 nach über 20 Jahren stillgelegt (weitere Informationen und ein kleiner Rückblick).
Registrierungen, Anmeldungen und Postings sind nicht mehr möglich. Öffentliche Inhalte sind weiterhin zugänglich.
Das Team von spieleprogrammierer.de bedankt sich bei der Community für die vielen schönen Jahre.
Wenn du eine deutschsprachige Spieleentwickler-Community suchst, schau doch mal im Discord und auf ZFX vorbei!
Werbeanzeige
Frischling
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 |
g_hWindow = CreateWindow(L"Direct3D window", pcName, WS_VISIBLE | WS_OVERLAPPEDWINDOW, GetSystemMetrics(SM_CXSCREEN) / 2 - iWidth / 2, GetSystemMetrics(SM_CYSCREEN) / 2 - iHeight / 2, iWidth, iHeight, NULL, NULL, GetModuleHandle(NULL), NULL); |
Zitat von »"BlackSnake"«
oder du schreibst ein
C-/C++-Quelltext
1 (wchar_t*)
davor.
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
#include <string> #include <locale> #include <functional> #include <vector> #include <boost/utility.hpp> template < typename CharType, typename CharTraits = std::char_traits< CharType >, typename Alloc = std::allocator< CharType > > struct WideString : public std::unary_function< const std::string&, std::basic_string< CharType, CharTraits, Alloc > > , private boost::noncopyable { typedef std::basic_string< CharType, CharTraits, Alloc > ResultType; WideString( const std::locale& locale_ = std::locale() ) : locale( locale_ ) { ctype = &std::use_facet< std::ctype< CharType > >( locale ); } ResultType operator()( const std::string& str ) const { typename ResultType::size_type len = str.length(); const char* src = str.c_str(); std::vector< CharType > tmp( len ); ctype->widen( src, src+len, &tmp[ 0 ] ); return ResultType( &tmp[ 0 ], len ); } private: std::locale locale; const std::ctype< CharType >* ctype; }; void blubb( const wchar_t* str ) { std::wcout << str << std::endl; } int main() { std::string foo( "Hallo Welt" ); std::wstring bar( WideString< wchar_t >()( foo ) ); blubb( bar.c_str() ); std::cin.get(); } |
Frischling
Frischling
Werbeanzeige