List box的使用

//List Box内容的建立  

for ( int n = 0; n < count; n++) {
    // LB_INSERTSTRING Message

    // Inserts a string or item data into a list box.

    // lResult = SendMessage( hWndControl,            LB_INSERTSTRING,       wParam,                lParam     );

    //     wParam : The zero-based index of the position at which to insert the string.

    //     lParam   :  A pointer to the null-terminated string to be inserted.

    SendDlgItemMessage(hwnd, IDC_HvE01NSPRT_COMBO_KINMU,
     CB_INSERTSTRING, (WPARAM)setDataCount, (LPARAM)pData[n].name);  //插入列表一行的文字

 

    // LB_SETITEMDATA Message

    // Sets a value associated with the specified item in a list box.

    // lResult = SendMessage( hWndControl,            LB_SETITEMDATA,       wParam,                lParam     );

    //     wParam : Specifies the zero-based index of the item.

    //     lParam   : Specifies the value to be associated with the item.

    iItemData = atoi(pData[n].code);

    SendDlgItemMessage(hwnd, IDC_HvE01NSPRT_COMBO_KINMU,
     CB_SETITEMDATA, (WPARAM)setDataCount, (LPARAM)iItemData);           //设定所插入行的代表数值
    setDataCount++;
   }
  }


//List Box的使用

    // LB_GETCURSEL Message

    // Gets the index of the currently selected item, if any, in a single-selection list box.

    // lResult = SendMessage( hWndControl,            LB_GETCURSEL,       wParam,                lParam     );

    //     wParam : Not used; must be zero.

    //     lParam   : Not used; must be zero.

   no = SendDlgItemMessage(hwnd, IDC_HvE01NSPRT_LIST_SHEET,
          LB_GETCURSEL, (WPARAM)0, (LPARAM)0);      //取得选择项的索引
   

    // LB_GETITEMDATAMessage

    // Gets the application-defined value associated with the specified list box item.

    // lResult = SendMessage( hWndControl,            LB_GETITEMDATA,       wParam,                lParam     );

    //     wParam : The index of the item.

    //     lParam   : Not used; must be zero.

   retNo = SendDlgItemMessage(hwnd, IDC_HvE01NSPRT_LIST_SHEET, LB_GETITEMDATA,
          (WPARAM)no, (LPARAM)0);                              //取得选择行的代表数值,即上面SETITEMDATA设定的值
   switch(retNo){

        ......

   }

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值