Click to See Complete Forum and Search --> : [RESOLVED] a little help


ccubed
August 14th, 2008, 10:54 PM
So now i'm screwing with SetConsoleTitle and I keep getting conversion errors.


string title = "Testing Console Functions";

SetConsoleTitle(title.c_str());


I keep getting this error whether I make it LPCSTR, LPCWSTR, Const Char, Char or String. So what am I doing wrong?


1>c:\users\cooper\documents\visual studio 2008\projects\forgotten_truths2\forgotten_truths2\main.cpp(41) : error C2664: 'SetConsoleTitleW' : cannot convert parameter 1 from 'const char *' to 'LPCWSTR'

Runt888
August 14th, 2008, 11:11 PM
You can use TCHAR, and the _T or _TEXT macros to hard code in strings:

TCHAR* title = _T( "Testing Console Functions" );

SetConsoleTitle( title );


Kelly

ccubed
August 14th, 2008, 11:17 PM
You can use TCHAR, and the _T or _TEXT macros to hard code in strings:

TCHAR* title = _T( "Testing Console Functions" );

SetConsoleTitle( title );


Kelly

What include do I need for _T or _TEXT. both result in identifier not found errors.

Runt888
August 14th, 2008, 11:22 PM
I think tchar.h.

Kelly

ccubed
August 14th, 2008, 11:30 PM
I think tchar.h.

Kelly

Yeah. Thank you.