16,472
社区成员
发帖
与我相关
我的任务
分享
void CLogin::OnEnKillfocusServer()
{
// TODO: 在此添加控件通知处理程序代码
#ifdef _DEBUG
CString s;
CString s1;
int t=GetTickCount();
#endif
CString sIP;
m_Server.GetWindowText(sIP);
theDataCentry.LoadServer(sIP.GetBuffer());
if (theDataCentry.TxServer == NULL)
{
return;
}
_RecordsetPtr rs=theDataCentry.TxServer->GetAccountList();
#ifdef _DEBUG
s.Format(_T("The time of Load Data is %d ms\n"),GetTickCount()-t);
#endif
m_Account.ResetContent(); //m_Account 为CComboBox类
m_Account.SetDroppedWidth(30);
if (rs->RecordCount>0)
{
rs->MoveFirst();
while (!rs->adoEOF)
{
FieldPtr fld=rs->GetFields()->Item["AccountName"];
BSTR bs=fld->GetValue().bstrVal;
char* px;
UnicodeToAnsi(bs,&px);
int idx=m_Account.AddString((LPCTSTR)px);
CoTaskMemFree(px);
fld=rs->GetFields()->Item["KeyID"];
long KeyID=(long)fld->Value.lVal;
//LPSTR pc=NULL;
//UnicodeToAnsi((LPWSTR)fld->Value.pbstrVal,&pc);
if (idx!=CB_ERR)
{
m_Account.SetItemData(idx,KeyID);
}
rs->MoveNext();
}
}
#ifdef _DEBUG
t=GetTickCount()-t;
s1.Format(_T("The time of total is %d ms\n"),t);
TRACE(s);
TRACE(s1);
#endif
}
void CLogin::OnEnKillfocusServer()
{
// TODO: 在此添加控件通知处理程序代码
#ifdef _DEBUG
CString s;
CString s1;
int t=GetTickCount();
#endif
CString sIP;
m_Server.GetWindowText(sIP);
theDataCentry.LoadServer(sIP);
if (theDataCentry.TxServer == NULL)
{
return;
}
_RecordsetPtr rs=theDataCentry.TxServer->GetAccountList();
#ifdef _DEBUG
s.Format(_T("The time of Load Data is %d ms\n"),GetTickCount()-t);
#endif
m_Account.ResetContent();
//m_Account.SetDroppedWidth(30);
//BSTR acName=SysAllocString(_T("AccountName"));
if (rs->RecordCount>0)//本测试加载的只有10条数据
{
rs->MoveFirst();
while (!rs->adoEOF)
{
FieldPtr fld=rs->GetFields()->Item[_T("AccountName")];
BSTR bs=fld->GetValue().bstrVal;
char* px;
//UnicodeToAnsi(bs,&px);
int idx=m_Account.AddString(bs);//((LPCTSTR)px);
//CoTaskMemFree(px);
//fld=rs->GetFields()->Item[cKeyID];
long KeyID=(long)rs->GetCollect(cKeyID);//fld->Value;
//LPSTR pc=NULL;
//UnicodeToAnsi((LPWSTR)fld->Value.pbstrVal,&pc);
if (idx!=CB_ERR)
{
m_Account.SetItemData(idx,KeyID);
}
rs->MoveNext();
}
}
#ifdef _DEBUG
t=GetTickCount()-t;
s1.Format(_T("The time of total is %d ms\n"),t);
TRACE(s);
TRACE(s1);
#endif