TB_ADDSTRING

 TB_ADDSTRING

在工具栏的数据结构中,有一个字符串列表,在添加或者插入工具栏按钮的时候,可以使用这个列表中的字符串作为按钮文字。TB_ADDSTRING 消息用来向工具栏的字符串列表添加一个或多个新的字符串。

TB_ADDSTRING 
    wParam 
=  (WPARAM) (HINSTANCE) hinst; 
    lParam 
=  (LPARAM) MAKELONG(idString,  0 ); 

Parameters

hinst
Handle to the module instance with an executable file that contains the string resource. If idString instead points to a character array with one or more strings, set this parameter to NULL.

idString
Resource identifier for the string resource. If hinst is set to NULL, idString points to a character array with one or more null-terminated strings. The last string in the array must be terminated with two null characters.

Return Values

Returns the index of the first new string if successful, or -1 otherwise.

 

Remarks 
上面的内容 Copy 自 MSDN,尽管我知道大家英语水平都挺不错的,但我还是画蛇添足地给大家解释一下。按照 MSDN 的意思,TB_ADDSTRING 的参数存在以下两种组合方式:
 
方式一:
    wParam = (HINSTANCE)hinst;            // 包含字符串资源的模块句柄
    lParam = (MAKELONG)(idString, 0);   // 一个字符串资源的资源 ID
 
在 MFC 的 CToolBarCtrl 中,我们可以找到与之对应的封装函数 CToolBarCtrl::AddString(),其实现如下:
 
int  CToolBarCtrl::AddString(UINT nStringID)
{
 ASSERT(::IsWindow(m_hWnd));
 HINSTANCE hInst 
=  AfxFindResourceHandle(MAKEINTRESOURCE((nStringID >> 4 ) + 1 ),
  RT_STRING);
 ASSERT(hInst 
!=  NULL);
 
return  ( int )::SendMessage(m_hWnd, TB_ADDSTRING, (W
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值