On WM_KEYDOWN I am setting the text of a label like so:
This seems to work well for digits and letters but nothing else.Code:case WM_KEYDOWN: setText((int)wParam); break; void setText(int x){ LPTSTR ItemText; ItemText = new TCHAR[50]; GetWindowText(hwndStatic, ItemText, 50); char c = (char)x; char* a = new char[2]; a[0] = c; a[1] = '\0'; strcat(ItemText, a); SetWindowText(hwndStatic, ItemText); delete[] ItemText; delete[] a; }
What is a better way to code this?




Reply With Quote