Reading UNICODE into an edit
I'm a n00b to unicode so go easy on me, I'm also the type who likes to code first and read documentation later.
I'm trying to read a unicode file, and I've pretty much got it working. But there is a bit that I'm not quite certain about, so here we go.
I'm opening and reading the file like this:
In summary of the below variables, the important ones:
char buff - contains the file, read from readFile()
char mbbuff - contains result of WideCharToMultiByte()
And when all is said and done, I just set the edit text to mbbuff. I'm assuming it's just me not setting the correct properties for the control because I'm getting weird chars and stuff everywhere. Including some that usually appear when you try to write from a buffer that has no text or whatever so I've got a bit of a memory problem as well I'm afraid.
HANDLE file = CreateFile(
if( file == INVALID_HANDLE_VALUE )
MessageBox( NULL, "Failed to open eng.utxt!", "Error", MB_OK | MB_ICONERROR );
DWORD SIZE = GetFileSize( file, NULL );//40000;
bool rf = ReadFile(
if( !rf )
MessageBox( NULL, "ReadFile() Failed!", "Error", MB_OK | MB_ICONERROR );
CloseHandle( file );