Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C++
::SendMessage (curScintilla, SCI_SETKEYSUNICODE, true, 0);
		
int	nLength = ::SendMessage(curScintilla, SCI_GETLENGTH, 0, NULL);

TCHAR * pBuffer = new TCHAR[nLength + 1];

::memset ((void *)pBuffer, 0, sizeof(TCHAR) * (nLength + 1));

int nTempLength = (int) ::SendMessage(curScintilla, SCI_GETTEXT, nLength + 1, (LPARAM)pBuffer);

strText.append(pBuffer);

delete pBuffer;


SCI_GETTEXT returns hieroglyphs.

What do I need to do to get text?

Thanks.
Posted

According to the documentation[^], this message returns ASCII characters.
 
Share this answer
 
Comments
JS00001 15-Oct-13 11:33am    
Text for retrieval is in ANSI so I used SendMessageA and got desired result.
Richard MacCutchan 15-Oct-13 11:45am    
That won't make any difference. The key is that the returned data is ANSI and must be stored in a char buffer, not a wchar_t buffer
C++
nLength = ::SendMessage(curScintilla, SCI_GETLENGTH, 0, NULL);

CHAR * pBuffer = new CHAR[nLength + 1];
			
::memset ((void *)pBuffer, 0, sizeof(CHAR) * (nLength + 1));

int nTempLength = (int) ::SendMessageA(curScintilla, SCI_GETTEXT, nLength + 1, (LPARAM)pBuffer);
		  
delete pBuffer;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900