ComboBox Items hinzufügen problem..



  • Du weisst aber was das "*" vor dem "test" bedeutet, oder???
    Auch solltest Du "CBS_HASSTRINGS" setzen...



  • und wie soltle es dann aussehen?



  • ind = SendMessage(hChannel, CB_ADDSTRING, 0, test);
    


  • geht auch nicht 😞



  • CBS_HASSTRINGS !???????



  • hier ein größerer ausschnitt, wo man alles sieht:

    LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
    {
        char txt[256]; // Vtext of hMsg
        int ind;
        char *test = "fdsgdfsg";
        switch (message)                  /* handle the messages */
        {
            case WM_CREATE:
                /* ::::: DIE COMBOBOX UND BUTTON ::: */
                hChannel = CreateWindowEx(WS_EX_CLIENTEDGE, "ComboBox", "", WS_VISIBLE|WS_CHILD|CBS_DROPDOWNLIST|CBS_HASSTRINGS,
                    100,
                    10,
                    200,
                    20,
                    hwnd, (HMENU)CMB_CHANNEL, ((LPCREATESTRUCT) lParam) -> hInstance, 0);
                PrevhChannel = SetWindowLongPtr (hChannel, GWLP_WNDPROC, (LONG_PTR) ChannelControl);
                CreateWindowEx(WS_EX_CLIENTEDGE,"Button",
                                      "Verbinden",
                                      WS_CHILD | WS_VISIBLE,
                                      310, // x-pos
                                      10, //y-pos
                                      100, // width
                                      25, //height
                                      hwnd, (HMENU)BTN_CONNECT, ((LPCREATESTRUCT) lParam) -> hInstance, NULL);
                CreateWindowEx(WS_EX_CLIENTEDGE,"Button",
                                      "Trennen",
                                      WS_CHILD | WS_VISIBLE,
                                      415, // x-pos
                                      10, //y-pos
                                      100, // width
                                      25, //height
                                      hwnd, (HMENU)BTN_DICONNECT, ((LPCREATESTRUCT) lParam) -> hInstance, NULL);
    
                 /* ::: Chat Control (RichText) */
                 hChat = CreateWindowEx(WS_EX_CLIENTEDGE, "RichEdit", "", 
                     WS_VISIBLE|WS_CHILD|WS_VSCROLL|ES_MULTILINE|ES_AUTOVSCROLL, // style
                     10, // x -Position
                     40, // y-Postiotns
                     580,  // länge
                     290, // höhe
                     hwnd, (HMENU)TXT_CHAT, ((LPCREATESTRUCT) lParam) -> hInstance, 0);
                 PrevhChat = SetWindowLongPtr (hChat, GWLP_WNDPROC, (LONG_PTR) ChatControl);
                 /* ::: MSG Control (EditBox) */
                 hMsg = CreateWindowEx(WS_EX_CLIENTEDGE, "Edit", "", 
                     WS_VISIBLE|WS_CHILD|WS_BORDER|ES_WANTRETURN|ES_AUTOHSCROLL, // style
                     10, // x -Position
                     335, // y-Postiotns
                     510,  // länge
                     25, // höhe
                     hwnd, (HMENU)TXT_MSG, ((LPCREATESTRUCT) lParam) -> hInstance, 0);
                     /* CALLBACK */
                 PrevhMsg = SetWindowLongPtr (hMsg, GWLP_WNDPROC, (LONG_PTR) MsgControl);
                 /* ::: Button Send Controll ::: */
                 hSend = CreateWindowEx(WS_EX_CLIENTEDGE,"Button",
                                      "Send",
                                      WS_CHILD | WS_VISIBLE,
                                      525, // x-pos
                                      335, //y-pos
                                      65, // width
                                      25, //height
                                      hwnd, (HMENU)BTN_SEND, ((LPCREATESTRUCT) lParam) -> hInstance, NULL);
                /* SEND MESSAGES */
                ind = SendMessage(hChannel, CB_ADDSTRING, 0, (LPARAM)test);
                //SendMessage(hChannel, CB_INSERTSTRING, ind, (LPARAM)*txt2);
                 break;
    ...
    


  • PrevhChannel = SetWindowLongPtr (hChannel, GWLP_WNDPROC, (LONG_PTR) ChannelControl);

    Wieso tauschst du die Window proc da aus. Wie sieht ChannelControl aus.



  • Liegt fast immer daran das die ComboBox zu klein ist.



  • hmm, an der größe leigt es nicht den 200px breit reicht wohl für "Test"^^

    hier das CALLBACK von ChannelControl .

    LRESULT CALLBACK ChannelControl (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
    {
        switch(msg)
        {
    
        }
    
        return CallWindowProc ((WNDPROC) PrevhChannel, hwnd, msg, wParam, lParam);  
    }
    

    habe da ncoh ncihts gemacht 😉



  • Es kommt aber auf die Höhe an.


Anmelden zum Antworten