Code:
char* GrabTextFromEdit(int nResourceID, HWND hwndMain) { int len = GetWindowTextLength(GetDlgItem(hwndMain, nResourceID)); if (len > 0) { char* buffer; buffer = (char*)GlobalAlloc(GPTR, len + 1); GetDlgItemText(hwndMain, nResourceID, buffer, len + 1); return buffer; } }
If use this function to get text from an edit control made from a dialog that is empty, I get what I want, a char* filled with "(null)". I thought that was nice, but then when I use this same function to get text from an edit control made on runtime (createwindow) then I get a null pointer as a return.
Have any ideas on how to recognize if the edit box is empty?
Sure, I could use the catch/try, but, long story short, in this situation I don't want to use it.
Comment