Thread: Deal or No Deal listbox prob

  1. #1
    Registered User kryptkat's Avatar
    Join Date
    Dec 2002
    Posts
    638

    Deal or No Deal listbox prob

    Deal or No Deal listbox prob

    Having a prob sending items to the listboxes. There are three list boxes high side low side and offer.
    Code:
    SetDlgItemText(hwnd, IDC_TEXT, "This is a string
    I have no idc-text as the example came from. Have tried sendmessage and setdlgitem. The prob seems to be addressing the listbox.

    Code:
    void creatbuttonlistboxoffer( HWND hwnd )
    {
          UINT lbo;
         
    HWND Button = CreateWindow(  
        "LISTBOX",   // predefined class 
        "NO DEAL!",       // button text 
        WS_VISIBLE | WS_CHILD | LBS_HASSTRINGS ,  // styles 
     
        // Size and position values are given explicitly, because 
        // the CW_USEDEFAULT constant gives zero values for buttons. 
        130,         // starting x position 
        190,         // starting y position 
        180,        // button width 
        100,        // button height 
        hwnd,       // parent window 
    
        NULL,       // No menu 
       (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), 
        NULL);      // pointer not needed 
     
    }
    is how the listbox is setup. Have tried “creatbuttonlistboxoffer” in the sendmessage and setdlgitemtext spots id. Where idc-listbox or idc-text would be. I left them in the comments. Errors are can not convert void to hwnd etc. tried casting them that do not work eighter. Meow! Could redo code like winforge examples using resource style listbox but want to know how to send with using creatwindowex way. Attached I hope is code.

    thank you meow

  2. #2
    Registered User
    Join Date
    Mar 2005
    Location
    Mountaintop, Pa
    Posts
    1,058
    The following must be declared as GLOBAL.
    Code:
    HWND ButtonLow;
    Then call..
    Code:
    SendMessage(ButtonLow, LB_ADDSTRING, 0,	(LPARAM)"This is a string");

  3. #3
    Registered User kryptkat's Avatar
    Join Date
    Dec 2002
    Posts
    638

    yipp

    Ok put
    Code:
    /* Deal or NO Deal .cpp */
    
    #include <windows.h>
    #include <stdio.h>
    
    HWND creatbuttonlistboxoffer;
    
    ....
    
    SendMessage(creatbuttonlistboxoffer, LB_ADDSTRING, 0,	(LPARAM)"This is a string");
    declared global. Getting error
    788 C:\Dev-Cpp\Project55DorND2\DealorNODeal.cpp `void creatbuttonlistboxoffer(HWND__*)' redeclared as different kind of symbol

    6 C:\Dev-Cpp\Project55DorND2\DealorNODeal.cpp previous declaration of `HWND__*creatbuttonlistboxoffer'

    6 C:\Dev-Cpp\Project55DorND2\DealorNODeal.cpp previous non-function declaration `HWND__*creatbuttonlistboxoffer'

    788 C:\Dev-Cpp\Project55DorND2\DealorNODeal.cpp conflicts with function declaration `void creatbuttonlistboxoffer(HWND__*)'

    and few more errors

  4. #4
    Registered User
    Join Date
    Mar 2005
    Location
    Mountaintop, Pa
    Posts
    1,058
    I've attached the modified source code that illustrates the above solution

  5. #5
    Registered User kryptkat's Avatar
    Join Date
    Dec 2002
    Posts
    638
    thank you.
    looking it over.
    meow.

  6. #6
    Registered User kryptkat's Avatar
    Join Date
    Dec 2002
    Posts
    638
    Ok it works
    I see what I did and how it works. Thought the prob was with the sendmessage but it was with how I was setting up the window handle.

    Still trying to figure out how the odds are calculated for the offers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. ListBox Extra Data Storage
    By Welder in forum Windows Programming
    Replies: 1
    Last Post: 11-01-2007, 01:46 PM
  2. Listbox search
    By Elsindes in forum Windows Programming
    Replies: 4
    Last Post: 04-09-2007, 03:47 PM
  3. cant load dialog with listbox, help
    By terracota in forum Windows Programming
    Replies: 2
    Last Post: 11-22-2004, 07:11 PM
  4. How to cast a ListBox item to an int for a switch statment?
    By Swaine777 in forum C++ Programming
    Replies: 8
    Last Post: 09-26-2004, 08:52 PM
  5. Getting FULL filename from listbox
    By Garfield in forum Windows Programming
    Replies: 8
    Last Post: 01-27-2002, 08:28 AM