
Originally Posted by
VictorN
Use CreateFile / ReadFile Win32 API functions
Oh... seems I found the solution using your help... though there are still problems...:
Code:
HANDLE file = CreateFile(ofn.lpstrFile, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
DWORD fileSize = GetFileSize(file, NULL);
LPSTR buffer = (LPSTR)GlobalAlloc(GPTR, fileSize + 1);
DWORD read;
ReadFile(file, buffer, fileSize, &read, NULL);
SetWindowTextA(hEdit, buffer);
Can you see any problems with the above code?
I also still have the problem that the text is invisible inside the text box until the user HIGHLIGHTS (click-drags mouse over it) it.
Any idea how to cause the text box (hEdit) to refresh after the SetWindowTextA operation?