button storing problem

This is a discussion on button storing problem within the Windows Programming forums, part of the Platform Specific Boards category; Code: case HEX_BUTTON_1: SetDlgItemText(HexWindow,HEX_HEDIT,"1"); store_info[counter] = 1; counter++; break; case HEX_CALCULATE: { SetDlgItemInt(HexWindow,HEX_HEDIT,store_info,false); counter = 0; } break; Im trying ...

  1. #1
    Registered User
    Join Date
    Feb 2006
    Posts
    71

    button storing problem

    Code:
                            case HEX_BUTTON_1:
                                 SetDlgItemText(HexWindow,HEX_HEDIT,"1");
                                 store_info[counter] = 1;
                                 counter++;
                            break;
                            
                            case HEX_CALCULATE:
                                 {
                                     SetDlgItemInt(HexWindow,HEX_HEDIT,store_info,false);
                                     counter = 0;
                                 }
                            break;
    Im trying to find a way to have it so all the information gets stored into store_info and then printed out >.>, but that makes the edit box hold 4215384 everytime i click on calculate.

  2. #2
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    Location
    New York
    Posts
    1,465
    Well, store_info looks like an array. You will need to make a character buffer and fill it with all the data from store_info, and then SetDlgItemText.

  3. #3
    Registered User
    Join Date
    Feb 2006
    Posts
    71

    already tried

    Thats what I tried first, which in the long run will make this difficult >.>, Here is what I had when I tried it making store_info a char array:

    Code:
                            case HEX_BUTTON_1:
                                 SetDlgItemText(HexWindow,HEX_HEDIT,"1");
                                 store_info[counter] = (char)1;
                                 counter++;
                            break;
                            
                            case HEX_CALCULATE:
                                 {
                                     SetDlgItemText(HexWindow,HEX_HEDIT,store_info);
                                     counter = 0;
                                 }
                            break;
    and I get the same problem, it prints out a weird character instead of 1.

    At this point, Im just trying to get store info to print out right, once I get this done, I can easily build the rest.

  4. #4
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    Location
    New York
    Posts
    1,465
    No, something more like this probably

    Code:
    			char buf[1024];
    
    			sprintf(buf, "%d %d %d", store_info[0], store_info[1], store_info[2]);
    
    			SetDlgItemText(HexWindow, HEX_HEDIT, buf);

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. BN_CLICKED, change button style
    By bennyandthejets in forum Windows Programming
    Replies: 13
    Last Post: 07-05-2010, 11:42 PM
  2. Pressing a button works sometimes
    By johny145 in forum Windows Programming
    Replies: 14
    Last Post: 05-18-2005, 11:53 AM
  3. writing text over a deleted button
    By algi in forum Windows Programming
    Replies: 4
    Last Post: 05-02-2005, 11:32 AM
  4. destroywindow() problem
    By algi in forum Windows Programming
    Replies: 6
    Last Post: 03-27-2005, 10:40 PM
  5. Window won't display on button command!?
    By psychopath in forum Windows Programming
    Replies: 6
    Last Post: 06-22-2004, 08:12 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21