|
int SipEnumIMProc(IMENUMINFO *pIMInfo)
{
CLSID* pCLSID = new CLSID;
memcpy(pCLSID,&pIMInfo->clsid,sizeof(CLSID));
g_SipMap.SetAt(CString(pIMInfo->szName),pCLSID);
TRACE(_T("%sn"),CString(pIMInfo->szName));
return 1;
}
void CTestHandDlg::OnBnClickedButton1()
{
// TODO: 在此添加控件通知处理程序代码
SipEnumIM(SipEnumIMProc);
CString sSipName;
CLSID *pCLSID = NULL;
for(POSITION pos = g_SipMap.GetStartPosition(); pos;)
{
g_SipMap.GetNextAssoc(pos,sSipName,pCLSID);
((CListBox*)GetDlgItem(IDC_LIST1))->AddString(sSipName);
}
}
void CTestHandDlg::OnBnClickedButton2()
{
// TODO: 在此添加控件通知处理程序代码
//SipEnumIM(SipEnumIMProc);
CString temp;
int nIndex = ((CListBox*)GetDlgItem(IDC_LIST1))->GetCurSel();
((CListBox*)GetDlgItem(IDC_LIST1))->GetText(nIndex,temp);
CString sSipName;
CLSID *pCLSID = NULL;
for(POSITION pos = g_SipMap.GetStartPosition(); pos;)
{
g_SipMap.GetNextAssoc(pos,sSipName,pCLSID);
if(sSipName == temp)
{
SipSetCurrentIM(pCLSID);
break;
}
}
} |
|