To make it more clear is this how you use GlobalAlloc and only work with one variabel?
Code:
int index;
char *buf;
int strLen;
buf = (char*)GlobalAlloc(GPTR, 50);
itoa((int)myHWND, buf, 10);
index = SendDlgItemMessage(hwnd, IDC_LIST, LB_ADDSTRING, 0, (LPARAM)buf);
itoa((int)myHWND, buf, 10);
index = SendDlgItemMessage(hwnd, IDC_LIST, LB_ADDSTRING, 0, (LPARAM)buf);
strLen = GetWindowTextLength(myHWND);
buf = (char*)GlobalAlloc(GPTR, strLen+1);
GetWindowText(myHWND, buf, strLen);
index = SendDlgItemMessage(hwnd, IDC_LIST, LB_ADDSTRING, 0, (LPARAM)buf);