I want to read the text which the user has typed in a Edit control.
after entering the text and pressing the button, I want to get the text and add it as an item into a comboBox.
this is what I am doing in WM_COMMAND of the parent dialog:
case WM_COMMAND:
    if(HIWORD(wParam) == BN_CLICKED)
    {
        if ((HWND)lParam == Button[0])
        {
                int len = GetWindowTextLengthW(Button[2]) + 1;
                GetWindowTextW(Button[2], text, len);
                SendMessage(Button[1],(UINT) CB_ADDSTRING,(WPARAM) 0,(LPARAM) text);
                }
        }
    return 0;
but things goes wrong, sometime I get NULL in the "text" variable, sometimes just the first character of the string the user has entered and sometime weird ASCII like characters. what am I doing wron? any ideas ?
 
    