Trouble Adding to ComboBox (*not* an LB_ issue..)
I have been absolutely banging my head against various hard surfaces trying to understand what the problem is here.
I am creating a clipboard monitoring utility that, at this point, will simply see if the clipboard item is text, if so, add it to a ComboBox. Should be about the easiest thing to do, right?? All I get is garbly-gook when I SendMessage to ComboBox using the code below. If I replace the LPARAM with TEXT("test"), "test" is added to the ComboBox successfully.
Any help would be GREATLY appreciated. I'm using Code::Blocks IDE and compiling with MinGW / GNU C++
HGLOBAL hglb = GetClipboardData(CF_TEXT);
if (hglb != NULL)
LPCTSTR str = (LPCTSTR) GlobalLock(hglb);
if (str != NULL)
SendMessage(hComboBox, CB_INSERTSTRING, 0, (LPARAM) str);
SendMessage (hComboBox, CB_SETCURSEL, 0, 0);