唉!不要乱用函数哦,特别是你不熟悉的!




                                      编程心得

                                                                                                            ------调试和错误

      今天找了错误找了半天!!起码三个小时!!!就因为下面这一行代码。导致我程序处处有错!!!!

      本来可以用   :m_IDGetitemText(Pos,0);这样的重载函数完成的,我非得用下面犯错的那个!!

      结果第四个参数搞不懂什么回事,就乱写了一个!谁知道出错了,这个m_ID变量是跟数据库关联的,这个字段的值长度已定为  16,但是我非得弄个20!!!!

      最后也是作死,各种错误!!!!!!

  m_Grid.GetItemText(Pos,0,(LPTSTR)(LPCTSTR)m_ID,20);//最后一个参数是说明 :缓冲区的长度指向   由第三个参数指向,但是因为
                                                       //数据库里面对字段域有限制,所以这里不匹配的话很容易出错的!!!找了大半天
                                                       //各种不知名的错误的源头就是它!!!!


CListCtrl::GetItemTextVisual Studio 2010



Retrieves the text of a list view item or subitem.

int GetItemText(
   int nItem,
   int nSubItem,
   LPTSTR lpszText,
   int nLen 
) const;
CString GetItemText(
   int nItem,
   int nSubItem 
) const;
int GetItemText(
   int nItem,
   int nSubItem,
   LPTSTR lpszText,
   int nLen 
) const;
CString GetItemText(
   int nItem,
   int nSubItem 
) const;
Parameters

nItem

The index of the item whose text is to be retrieved.

nSubItem

Specifies the subitem whose text is to be retrieved.

lpszText

Pointer to a string that is to receive the item text.

nLen

Length of the buffer pointed to by lpszText.

Return Value

The version returning int returns the length of the retrieved string.

The version returning a CString returns the item text.

Remarks

If nSubItem is zero, this function retrieves the item label; if nSubItem is nonzero, it retrieves the text of the subitem. For more information on the subitem argument, see the discussion of the LVITEM structure in the Windows SDK.

Requirements
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值