CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2002
    Location
    Colorado, U.S.A.
    Posts
    980

    Unicode and EM_GETLINE

    I having trouble getting a Unicode character from a single line EDIT control. This code works for non-unicode and unicode if the character is one of the ASCII characters:

    Code:
    int length = SendMessage( hwnd, EM_LINELENGTH, 0, 0 );
    
    if( length > 0 )
    {
    	TCHAR* buffer = new TCHAR[length + 1];
    	buffer[length] = '\0';
    	buffer[0] = length;
    
    	SendMessage( hwnd, EM_GETLINE, 0, (LPARAM)buffer );
    }
    However, if I past Japanese characters into the edit box, then try to get the line, all I get are question marks (although the correct characters are shown). Does anyone know how to fix this? I would prefer to stick with the edit control if possible, and not use a rich-edit.

    Thanks!

    Kelly

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

    Re: Unicode and EM_GETLINE

    Oops...nevermind...I was compiling with MBCS instead of Unicode.

    Kelly

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