谢谢,
源代码在这是

程序代码:
CListCtrlPop类
CStringList* CListCtrlPop::SelectStringList(int number, CStringList *newstringlist)
{
if(number<0)
{
MessageBox("stringlists.number<0");
return NULL;
}
ASSERT(newstringlist!=NULL);
CStringList* temp=m_strlist;
m_iColumns=number;
this->m_strlist=newstringlist;
this->ClearListAllColumn();
int length=0;
CString str;
int* col_length=new int[m_iColumns];
for(int k=0;k<m_iColumns;k++)
col_length[k]=8;
for(int i=0;i<m_iColumns;i++)
{
this->m_listctrl->InsertColumn(i,m_strlist[i].GetHead()); //编译到这里出错
col_length[i]=max(col_length[i],m_strlist[i].GetHead().GetLength());
POSITION pos=m_strlist[i].FindIndex(1);
for(int j=1;pos!=NULL;j++)
{
str=m_strlist[i].GetNext(pos);
col_length[i]=max(col_length[i],str.GetLength());
}
m_listctrl->SetColumnWidth(i,col_length[i]*10);//LVSCW_AUTOSIZE_USEHEADER
}
for(k=0;k<m_iColumns;k++)
length=length+col_length[k];
m_listctrl->MoveWindow(0,0,length*10+18,this->m_rectShow.Height()-7);
m_rectShow.right=length*10+26;
delete [] col_length;
return temp;
}
CDlgXSTH 类
bool CDlgXSTH::InitnListTH()
{
CRect rect_nlist(10,350,700,650);
this->GetClientRect(&rect_nlist);
rect_nlist.top=150;
rect_nlist.left+=10;
rect_nlist.right-=10;
rect_nlist.bottom=330;
this->m_plistTH=new CListXSTH(m_bXsth,this->m_strPh);
m_plistTH->Create(WS_CHILD|WS_VISIBLE|LVS_REPORT|
WS_BORDER,rect_nlist,this,ID_NEWLISTLSXSDJ);
//this->m_plistTH->OnParentMoved();
this->m_plistTH->ModifyStyle(LVS_EDITLABELS, 0L);
m_plistTH->ModifyStyle(0L, LVS_REPORT);
m_plistTH->ModifyStyle(0L, LVS_SHOWSELALWAYS);
m_plistTH->ModifyStyle(0L, LVS_NOSORTHEADER);
// m_plistTH->SetBkColor(RGB(0,200,200));
// m_plistTH->SetTextBkColor(RGB(0,200,200));
m_plistTH->ModifyStyle( LVS_OWNERDRAWFIXED,0L);
m_plistTH->SetExtendedStyle( LVS_EX_FULLROWSELECT |
// LVS_EX_HEADERDRAGDROP |
LVS_EX_GRIDLINES |
// LVS_EX_ONECLICKACTIVATE |
LVS_EX_FLATSB
// LVS_EX_UNDERLINEHOT
);
CString str;
// 1、先产生numTitle列
// m_plistTH->SetItemCount(20);
int i=0;
m_plistTH->InsertColumn( i, "商品编号" );
m_plistTH->InsertColumn( 1, "商品名称" );
m_plistTH->InsertColumn( 2, "仓库名称" );
m_plistTH->InsertColumn( 4, "数量" );
m_plistTH->InsertColumn( 5, "金额" );
if(this->m_bXsth)
{
m_plistTH->InsertColumn( 3, "单价" );
}
else
{
m_plistTH->InsertColumn( 3, "进价" );
}
// 2、插入1行
m_plistTH->InsertItem(0,"");
// 3、调整列宽
RECT rect2;
m_plistTH->GetWindowRect(&rect2);
int wid = rect2.right - rect2.left;
for( i=0; i<6; i++ )
{
m_plistTH->SetItemText(0,i,"");
m_plistTH->SetColumnWidth( i, wid/6 );
}
m_plistTH->SetSubItemCanEdited(0);
m_plistTH->SetSubItemCanEdited(1);
m_plistTH->SetSubItemCanEdited(2);
m_plistTH->SetSubItemCanEdited(3);
m_plistTH->SetSubItemCanEdited(4);
m_plistTH->SetSubItemCanEdited(5);
m_plistTH->Invalidate(false);
return true;
}
bool CListCtrlPop::Create(CWnd* parent)
{
bool result = CDialog::Create(IDD,parent);
this->ShowWindow(SW_HIDE);
this->InitListCtrl();
this->GetClientRect(&this->m_rectShow);
return true;
}
还有哪些类,你帮我分析一下
怎样查它CListCtrl::GetHead();被二次封装过
CListCtrl* m_listctrl;//这是一个指针,怎样找它实例化
void CListCtrlPop::ClearListAllColumn()
{
this->m_listctrl->DeleteAllItems();
int n=m_listctrl->GetHeaderCtrl()->GetItemCount();
for(int i=n-1;i>=0;i--)
this->m_listctrl->DeleteColumn(i);
}
在调试中只有到出错的信息:
_AFXCOLL_INLINE CString& CStringList::GetHead()
{ ASSERT(m_pNodeHead != NULL);//调试到这里是点击重试才到这里
return m_pNodeHead->data; }
到这里时,按F11就进入汇编代码:
0041E640 push ebp
0041E641 mov ebp,esp
0041E643 push 0FFh
0041E645 push 424DF8h
0041E64A push 41E840h
0041E64F mov eax,fs:[00000000]
0041E655 push eax
0041E656 mov dword ptr fs:[0],esp
0041E65D add esp,94h
0041E660 push ebx
0041E661 push esi
0041E662 push edi
0041E663 mov dword ptr [ebp-18h],esp
0041E666 mov dword ptr [ebp-4],0
0041E66D push 2
0041E66F call dword ptr ds:[422880h]
0041E675 add esp,4
0041E678 mov dword ptr ds:[42C030h],0FFFFFFFFh
0041E682 mov eax,[0042C030]
0041E687 mov [0042C034],eax
0041E68C call dword ptr ds:[422890h]
0041E692 mov ecx,dword ptr ds:[42C014h]
[
本帖最后由 fwherr 于 2015-1-19 15:10 编辑 ]