CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2007
    Location
    .NET 3.5 Beta SP1, Visual Basic 2008 Express
    Posts
    225

    [RESOLVED] a little help

    So now i'm screwing with SetConsoleTitle and I keep getting conversion errors.

    Code:
    	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?

    Code:
    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'
    Microsoft Visual Basic 2008 Express Edition
    .NET Framwork 3.5 Beta SP1

  2. #2
    Join Date
    Jun 2002
    Location
    Colorado, U.S.A.
    Posts
    980

    Re: a little help

    You can use TCHAR, and the _T or _TEXT macros to hard code in strings:
    Code:
    TCHAR* title = _T( "Testing Console Functions" );
    
    SetConsoleTitle( title );
    Kelly

  3. #3
    Join Date
    Jun 2007
    Location
    .NET 3.5 Beta SP1, Visual Basic 2008 Express
    Posts
    225

    Re: a little help

    Quote Originally Posted by Runt888
    You can use TCHAR, and the _T or _TEXT macros to hard code in strings:
    Code:
    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.
    Microsoft Visual Basic 2008 Express Edition
    .NET Framwork 3.5 Beta SP1

  4. #4
    Join Date
    Jun 2002
    Location
    Colorado, U.S.A.
    Posts
    980

    Re: a little help

    I think tchar.h.

    Kelly

  5. #5
    Join Date
    Jun 2007
    Location
    .NET 3.5 Beta SP1, Visual Basic 2008 Express
    Posts
    225

    Re: a little help

    Quote Originally Posted by Runt888
    I think tchar.h.

    Kelly
    Yeah. Thank you.
    Microsoft Visual Basic 2008 Express Edition
    .NET Framwork 3.5 Beta SP1

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured