停靠栏的问题,希望好心人帮帮忙看看,问题该怎么解决
停靠栏的问题,希望好心人帮帮忙看看,问题该怎么解决
我在停靠栏上放了listcontrol控件,代码如下:要实现当停靠栏显示时,listcontrol中的数据也显示出来!extern _connectionptr pconn;
bool cacdialogbar::create (cframewnd *pparent, uint nidtemplate, uint style, uint nid) {
if ( !cdialogbar::create (pparent, nidtemplate, style, nid) )
return (false) ;
msizecurrent =m_sizedefault ;
cacdialogbar m_mybar;
m_ctrlcopeople.subclassdlgitem(idc_ls_copeople,this);
dword dwstyle = m_ctrlcopeople.getextendedstyle();
dwstyle |= lvs_ex_fullrowselect dwstyle |= lvs_ex_gridlines;
m_ctrlcopeople.setextendedstyle(dwstyle); //设置扩展风格
m_ctrlcopeople.insertcolumn(0,"协同用户");
m_ctrlcopeople.insertcolumn(1,"协同方式");
m_ctrlcopeople.insertcolumn(2,"用户ip");
m_ctrlcopeople.insertcolumn(3,"协同项目");
m_ctrlcopeople.insertcolumn(4,"协同模块");
m_ctrlcopeople.setcolumnwidth(0,100);//设置列的宽度。
m_ctrlcopeople.setcolumnwidth(1,100);
m_ctrlcopeople.setcolumnwidth(2,100);
m_ctrlcopeople.setcolumnwidth(3,100);
m_ctrlcopeople.setcolumnwidth(4,100);
cstring vsql,vstrtype,vstrname,vstrip,vstrpid,vstrmid;
_recordsetptr vst;
_variant_t holder;
int i = 0;
vst.createinstance(__uuidof(recordset));
vsql.format("select * from tempcoinfo");
vst->open(_variant_t(vsql),pconn.getinterfaceptr(),adopendynamic,adlockoptimistic,adcmdtext);
if(!vst->adoeof)
{
m_ctrlcopeople.deleteallitems();
vst->movefirst();
while (!vst->adoeof)
{
lv_item lvitem;
lvitem.mask = lvif_text | lvif_image | lvif_state;
lvitem.state = 0;
lvitem.statemask = 0;
//char temp[50];
lvitem.iitem = i;
lvitem.isubitem = 0;
//lvitem.psztext =itoa(i, temp, 10);
//m_ctrlcopeople.insertitem(&lvitem);
holder=vst->getcollect("temptype");
vstrtype = holder.vt==vt_null?""

char *)(_bstr_t)holder;
holder=vst->getcollect("tempname");
vstrname= holder.vt==vt_null?""

char *)(_bstr_t)holder;
holder=vst->getcollect("tempip");
vstrip= holder.vt==vt_null?""

char *)(_bstr_t)holder;
holder=vst->getcollect("coprojectid");
vstrpid= holder.vt==vt_null?""

char *)(_bstr_t)holder;
holder=vst->getcollect("comodeid");
vstrmid= holder.vt==vt_null?""

char *)(_bstr_t)holder;
lvitem.psztext =(lpstr)lpcstr(vstrname) ;
m_ctrlcopeople.insertitem(&lvitem);
m_ctrlcopeople.setitemtext(i,1,(lpctstr)vstrtype); m_ctrlcopeople.setitemtext(i,2,(lpctstr)vstrip);
m_ctrlcopeople.setitemtext(i,3,(lpctstr)vstrpid);
m_ctrlcopeople.setitemtext(i,4,(lpctstr)vstrmid);
vst->movenext();
i=i+1;
}
}
vst->close();
delete vst;
return (true) ;
}
可是当运行时,所有m_ctrlcopeople.setitemtext()语句只能在最后一条记录显示出数据来,其余的都不显示查询到的数据,请问该问题怎么解决,谢谢!!!