ComboBox zeigt irgendwelche Zeichen an



  • Ich habe eine ComboBox mit VS2008 Express C++ erstellt und möchte nun Einträge in die Liste machen:

    HWND hWndComboBox;
    char *ComboBoxItems[] = { "Sri Lanka", "El Salvador", "Botswana","France", "Cuba" };
    
    hWndComboBox = CreateWindow(TEXT("COMBOBOX"),NULL,WS_CHILD | WS_VISIBLE | WS_TABSTOP  | CBS_DROPDOWNLIST,60, 80, 80, 100,hWnd,NULL,hInst,NULL);
    if( !hWndComboBox )
    {
         MessageBox(hWnd,TEXT("Could not create the combo box"),TEXT("Failed Control Creation"),MB_OK);
         return FALSE;
    }
    else
    {
         SendMessage(hWndComboBox,CB_ADDSTRING,0,reinterpret_cast<LPARAM>((LPCTSTR)(ComboBoxItems[0])));
         SendMessage(hWndComboBox,CB_ADDSTRING,0,reinterpret_cast<LPARAM>(TEXT("Hallo")));
    }
    

    Bei dem ersten SendMessage werden jedoch in der erstellen ComboBox nur irgendwelche Zeichen angezeigt. Bitte helft mir und sagt mir warum dies der Fall sein könnte.

    DANKE


  • Mod

    Wenn Du schon einen TCHAR cast nimmst, dann verwende auch TCHAR!

    TCHAR *ComboBoxItems[] = { _T("Sri Lanka"), _T("El Salvador"), _T("Botswana"), _T("France"), _T("Cuba") };
    
    ...
    


  • DANKE, funktioniert super


Anmelden zum Antworten