int main(int argc, char* argv[]) { CMyList list; for (int i = 1; i < 2; i++) list.AddTail(i); list.RemoveAt(0); printf("%d:", list.Length()); CNode *pNode = list.GetHead(); while(pNode != NULL) { printf("%d ", pNode->m_Elem); pNode = pNode->m_pNext; } printf("\r\n"); pNode = list.GetTail(); while(pNode != NULL) { printf("%d ", pNode->m_Elem); pNode = pNode->m_pPrev; } printf("\r\n"); return 0; }
void CMainDialog::OnClick( CControlUI* pSender) { if (pSender->GetName() == TEXT ("btnExit")) { PostQuitMessage(0); return; } else if (pSender->GetName() == _T ("btnTip")) { CControlUI* pbtnTip = static_cast <CControlUI*> (m_pm.FindControl(_T ("btnTip"))); if (pbtnTip) { pbtnTip->SetVisible(false); } CEditUI* peditSearch = static_cast <CEditUI*> (m_pm.FindControl(_T ("editSearch"))); if (peditSearch != NULL) { peditSearch->SetFocus(); } } else if (pSender->GetName() == _T ("lstDelButton")) { int iIndex = 0; CMyList* pParent = static_cast <CMyList*> (pSender->GetParent()->GetParent()); if (pParent) { iIndex = pParent->GetItemIndex(pSender->GetParent()); } CDuiString str; str.Format(_T ("您要删除 %d 项"), iIndex); if (IDNO == MessageBox (GetHWND (), str, NULL, MB_OK | MB_YESNO)) return; CMyList* pList = static_cast <CMyList*> (m_pm.FindControl(_T ("lstControl"))); ASSERT(pList); if (pList) { pList->RemoveAt(iIndex); CControlUI* pItem = pList->GetItemAt(iIndex+5); if (pItem) { const RECT& rc = pItem->GetPos(); SIZE sz = {0, rc.top}; pList->SetScrollPos(sz); } } } else if (pSender->GetName() == _T ("btnAddComboItem")) { CComboUI* pcbx = static_cast <CComboUI*> (m_pm.FindControl(_T ("combo1"))); assert (pcbx); if (pcbx) { CListLabelElementUI* pItem = new CListLabelElementUI (); pItem->SetText(_T ("{b}{i}新加项{/i}{/b}")); pcbx->Add(pItem); } AddComboboxItem(); CComboUI* pcbx2 = static_cast <CComboUI*> (m_pm.FindControl(_T ("combo2"))); } else if (pSender->GetName() == _T ("btnGoIe")) { CActiveXUI* pActiveXUI = static_cast<CActiveXUI*>(m_pm.FindControl(_T("ie"))); if( pActiveXUI ) { IWebBrowser2* pWebBrowser = NULL; pActiveXUI->GetControl(IID_IWebBrowser2, (void**)&pWebBrowser); if( pWebBrowser != NULL ) { CEditUI* pEdit = static_cast <CEditUI*> (m_pm.FindControl(_T ("editIePath"))); ASSERT (pEdit); CDuiString strIePath = _T ("www.baidu.com"); if (pEdit) { strIePath = pEdit->GetText(); } WCHAR szPath [1024] = {0}; #if defined(_UNICODE) || defined(UNICODE) lstrcpyW (szPath, strIePath); #else ::MultiByteToWideChar(CP_ACP, 0, strIePath, -1, szPath, 1023); #endif pWebBrowser->Navigate(szPath,NULL,NULL,NULL,NULL); pWebBrowser->Release(); } } } }