想向用sdk做的界面的list里面添加每一行的信息,需要那个api

解决方案 »

  1.   

    edit控件可以用SetWindowText函数
    其他的可以用GetDlgItem得到句柄后用SendMessage
      

  2.   

    用了SetWindowText, 可是不起作用.
      

  3.   

    SDK这样对list里面添加每一行信息:
    str = "你好";
    SendMessage(GetDlgItem(hwnd,IDC_LIST1),LB_ADDSTRING,0,LPARAM(str));
      

  4.   

    是向用 edit 改的 list 的里面添加
      

  5.   

    首先要用获取这个控件句柄API函数得到它得HWND ,再用SetWindowText应当可以添加文本了
      

  6.   

    各位的方法好像都不行呀, SetWindowText是怎么都不能添加一行的
      

  7.   

    发送消息!!!!!List Boxes:Another handy control is the list box. This is the last standard control that I'm going to cover for now, cause frankly
    they aren't that interesting, and if you aren't bored yet well, I am :)Adding Items:The first thing you'll want to do with a listbox is add items to it.
    int index = SendDlgItemMessage(hwnd, IDC_LIST, LB_ADDSTRING, 0, (LPARAM)"Hi
    there!");As you can see, this is a pretty simple task. If the listbox has the LBS_SORT style, the new item will be added in alphabetical order, otherwise it will just be added to the end of the list.
    This message returns the index of the new item either way, and we can use this to perform other tasks on the item,such as associating some data with it. Usually this will be things like a pointer to a struct containing more
    information, or maybe an ID that you will use to identify the item, it's up to you.
    SendDlgItemMessage(hwnd, IDC_LIST, LB_SETITEMDATA, (WPARAM)index,
    Standard Controls: Button, Edit, List Box, Static
    (LPARAM)nTimes);
      

  8.   

    oh, edit的可以添加的
    list box还是不行的