Problem with reading of edit control
Sep 4, 2011 at 3:54pm UTC
I'm having problem with writing a text from a control to a file and i can't figure out where the problem lies... Also I don't get the error that the LBuffer is empty... Could anyone help?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
void ChangeSettings002(HWND hwnd){
DWORD BufferLength, BufferLength1; LPSTR LBuffer; HWND LogCtrl;
LogCtrl = GetDlgItem(hwnd, IDC_CHANGENAME);
BufferLength = GetWindowTextLength(LogCtrl);
BufferLength1 = BufferLength + 1;
LBuffer = (LPSTR)GlobalAlloc(GPTR, BufferLength1);
GetWindowText(LogCtrl, LBuffer, BufferLength1);
if (LBuffer == NULL){
MessageBox(NULL, "LBuffer == NULL" , "ERROR" , MB_OK);
}
std::string Change = LBuffer;
std::ofstream set2("settings/002.bin" );
set2 << Change;
set2.close();
}
Sep 4, 2011 at 4:34pm UTC
Have you considered using GetDlgItemText?
Sep 8, 2011 at 6:52am UTC
I also have the same issue...after 2 hours of search finnaly i found the equivallent subject...
Topic archived. No new replies allowed.