1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Combo Box Insert String

Discussion in 'Win32' started by polyfrag, Sep 4, 2012.

  1. polyfrag

    polyfrag New Member

    Joined:
    Sep 4, 2012
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    0
    Why can't I insert these strings into my combobox?

    Code:
    	g_hWndFullscreenBox = CreateWindow("combobox", NULL, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_VSCROLL | CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED, 
    		MENU_WIDTH/2-150+100, 50, 200, 25, g_hWndMenu, (HMENU)ID_RESOLUTIONBOX, g_hInstance, NULL);
    
    	SendMessage(g_hWndFullscreenBox, CB_INSERTSTRING, ID_FULLSCREEN_YES, (LPARAM)"Yes");
    	SendMessage(g_hWndFullscreenBox, CB_INSERTSTRING, ID_FULLSCREEN_NO, (LPARAM)"No");
    
     
  2. NewsBot

    NewsBot New Member

    Joined:
    Dec 2, 2008
    Messages:
    1,267
    Likes Received:
    2
    Trophy Points:
    0
    Whats the error ?
     
  3. polyfrag

    polyfrag New Member

    Joined:
    Sep 4, 2012
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    0
    No error, I just don't see the strings in the combo box.
     
  4. NewsBot

    NewsBot New Member

    Joined:
    Dec 2, 2008
    Messages:
    1,267
    Likes Received:
    2
    Trophy Points:
    0
    Are you seeing the combo box correctly?
     
  5. polyfrag

    polyfrag New Member

    Joined:
    Sep 4, 2012
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    0
    Yes it is.
     
  6. NewsBot

    NewsBot New Member

    Joined:
    Dec 2, 2008
    Messages:
    1,267
    Likes Received:
    2
    Trophy Points:
    0
    Whats the error code returned with SendMessage
     
  7. polyfrag

    polyfrag New Member

    Joined:
    Sep 4, 2012
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    0
    They return 0 and 1.
     
  8. hobbyist

    hobbyist New Member

    Joined:
    Jan 7, 2012
    Messages:
    141
    Likes Received:
    0
    Trophy Points:
    0
    Something like this has usually worked for me

    Code:
    SendMessage(g_hWndFullscreenBox, 
       CB_INSERTSTRING, 
       ID_FULLSCREEN_YES, 
       (LPARAM)(LPCTSTR)"Yes");
    
    the wparam parameter is the index pos... what value have you assigned to ID_FULLSCREEN_YES and or ID_FULLSCREEN_NO? You might also try (WPARAM)-1 to see if it inserts the string at the end of list.

    You can always put a desired string in the edit part by using

    Code:
    SendMessage(g_hWndFullscreenBox, 
       CB_SETCURSEL, 
       desired_index, 
       0);
     
  9. polyfrag

    polyfrag New Member

    Joined:
    Sep 4, 2012
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    0
    Fixed. Had to increase height to accomodate the whole list of options.
     

Share This Page