当前位置: 首页>>代码示例>>C++>>正文


C++ CArray类代码示例

本文整理汇总了C++中CArray的典型用法代码示例。如果您正苦于以下问题:C++ CArray类的具体用法?C++ CArray怎么用?C++ CArray使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CArray类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: _T

// CString strDllFile(_T("E:\\DevTools\\VC6\\VC6.0.Full.G\\VC98\\Bin\\C1.DLL")); 
u32 CHookFunction_i::ViewExportFunctionInfo(LPCTSTR pszDllFile, LPCTSTR pszOutFile, bool bAutoOpenFile) // _T("[email protected]")
{
  u32 ret = ERR_OK_I;
  
  CArray<EXPORT_FUN_INFO, EXPORT_FUN_INFO&> InfoArray;
  
#ifdef HAVE_UNICODE_I 
  CHAR file[MAX_PATH] = {0, };
  CStringUtl::wcs2mbsz(file, wcslen(pszDllFile), pszDllFile);
  if(GetExportFunctionInfo(InfoArray, file) > 0)
#else
    if(GetExportFunctionInfo(InfoArray, pszDllFile) > 0)
#endif
    {
      CFile fileTmp;
      if(fileTmp.Open(pszOutFile, CFile::modeCreate | CFile::modeReadWrite))
      {
        CString strTmp;
        strTmp.Format("%s Export Information:", pszDllFile);
        fileTmp.Write(strTmp, strTmp.GetLength());
        
        for (int i=0;i < InfoArray.GetSize();i++)
        {
          EXPORT_FUN_INFO& r = InfoArray.ElementAt(i); // return the reference.
          
          if(r.dwOffset == 0)
            continue;
          
          strTmp.Format("\r\n%3d   0x%p   %s", r.dwOrdinal, r.dwOffset, r.strFunName);
          fileTmp.Write(strTmp, strTmp.GetLength());
        }
        
        fileTmp.Close();
        if(bAutoOpenFile)
        {
          ShellExecute(NULL, "open", "notepad.exe", pszOutFile, NULL, SW_NORMAL);
        }
      }
    }
    
    return ret;
}
开发者ID:fre2003,项目名称:l3220,代码行数:43,代码来源:ViewExportFunction_21.cpp

示例2: DeleteOldAndHighlightNew

// This is a little tricky.  We need to delete the current selection,
// while highlighting the newly dropped items, without letting them
// screw each other's indices up.
// We know that the newly dropped items are in a contiguous block,
// which helps.
void OleListCtrl::DeleteOldAndHighlightNew()
{
	// First, get a reverse-order list of selected items,
	// which will be deleted.
	CArray <int, int> anSelectedItems;
	anSelectedItems.SetSize( 0, 50 );
	int nA = -1;
	while ( ( nA = GetNextItem( nA, LVNI_SELECTED ) ) != -1 ) 
	{
		anSelectedItems.Add( nA );
	}
	UnselectAll();

	// Now select the dropped items.
	std::vector<int>::iterator it;
	for ( it = m_vnNewlyDroppedItems.begin(); it != m_vnNewlyDroppedItems.end(); ++it )
	{
		SetItemState( (*it), LVIS_SELECTED, LVIS_SELECTED );
	}

	// Now step through the deleted items, deleting.
	// We track the first newly dropped item as we go.
	int nFirst = m_vnNewlyDroppedItems[0];
	for ( nA = anSelectedItems.GetUpperBound(); nA >= 0; nA-- )
	{
		// There should be no overlap here!
		ASSERT( anSelectedItems[nA] != m_vnNewlyDroppedItems[0] );

		DeleteItem( anSelectedItems[nA], false );

		// Track the first slot as it slides up.
		if ( anSelectedItems[nA] < nFirst )
			nFirst--;
	}

	if ( nFirst >= 0 )
	{
		SetItemState( nFirst, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED );
	}

	m_vnNewlyDroppedItems.clear();
}
开发者ID:moodboom,项目名称:Reusable,代码行数:47,代码来源:OleListCtrl.cpp

示例3: OnInitDialog

BOOL CDlgCapture::OnInitDialog()
{
	CIBADialog::OnInitDialog();
	
	{
		CArray<CString, CString> arCapList;
		m_capImage.GetCapArray(arCapList);

		for(int i = 0; i < arCapList.GetCount(); i++)
		{
			// 2014-7-23 - qsc 由AddString改成InsertString
			m_comboDevices.InsertString(-1, arCapList.GetAt(i));
		}
		UINT nCameraIndex = CIBAConfig::GetInstance()->GetCameraIndex();
		if(nCameraIndex > m_comboDevices.GetCount())
		{
			nCameraIndex = 0;
			CIBAConfig::GetInstance()->SetCameraIndex(nCameraIndex);
		}
		m_comboDevices.SetCurSel (nCameraIndex);

		if (!m_capImage.Init(GetDlgItem(IDC_STATIC_VIDEO)->GetSafeHwnd(), -1))
		{
			// 2014-11-26 - qsc
			++nCameraIndex;
			CIBAConfig::GetInstance()->SetCameraIndex(nCameraIndex);
			if(nCameraIndex > m_comboDevices.GetCount())
			{
				nCameraIndex = 0;
				CIBAConfig::GetInstance()->SetCameraIndex(nCameraIndex);
			}

			IBA_LOG0(_T("摄像头初始化失败,没找到可用的摄像头"));
			EndDialog(IDCANCEL);
		}
	}
	
	UpdateData(FALSE);
	

	return TRUE;  
}
开发者ID:layerfsd,项目名称:PersonalIBA,代码行数:42,代码来源:DlgCapture.cpp

示例4: GetWeightFromLineWeight

int CMainFrame::GetWeightFromLineWeight(int nButtonID)
{
	CArray<CMFCRibbonBaseElement*, CMFCRibbonBaseElement*> arButtons;

	m_wndRibbonBar.GetElementsByID(nButtonID, arButtons);

	if (arButtons.GetSize() == 0)
	{
		return -1;
	}

	int weight = -1;
	CMFCRibbonGallery* pBtn = DYNAMIC_DOWNCAST(CMFCRibbonGallery, arButtons.GetAt(0));
	if (pBtn != NULL && pBtn->GetSelectedItem() != -1)
	{
		weight = pBtn->GetSelectedItem() + 1;
	}

	return weight;
}
开发者ID:Ireneph,项目名称:samples,代码行数:20,代码来源:mainfrm.cpp

示例5: GetBestInstrumentCandidate

int CAbstractVstEditor::GetBestInstrumentCandidate()
{
    //First try current instrument:
/*    CModDoc* pModDoc = m_pVstPlugin->GetModDoc();
    int currentInst =        //HOW DO WE DO THIS??
    if (CheckInstrument(currentInst)) {
            return currentInst;
    }
*/
    //Then just take the first instrument that points to this plug..
    CArray<UINT, UINT> plugInstrumentList;
    m_pVstPlugin->GetInputInstrumentList(plugInstrumentList);
    if (plugInstrumentList.GetSize())
    {
            return plugInstrumentList[0];
    }

    //No instrument in the entire track points to this plug.
    return -1;
}
开发者ID:aidush,项目名称:openmpt,代码行数:20,代码来源:AbstractVstEditor.cpp

示例6: main

int main()
{
    CArray arr;
    char* str = new char[MAX_LENGTH];
    cin >> str;
    while(!cin.eof()) {
        arr.Add(str);
        cin >> str;
    }
    
    //сортируем
    MSDSort(arr);
    
    for(int i = 0; i < arr.Size(); i++) {
        cout << arr[i] << endl;
    }
    
    delete[] str;
    return 0;
}
开发者ID:Lookyan,项目名称:algos,代码行数:20,代码来源:main.cpp

示例7: ReadCustomProfiles

HRESULT ProfileUtils::ReadCustomProfiles(CArray<ProfileInfo *, ProfileInfo *> &aProfileInformation) {
    HRESULT hr = S_OK;

    CArray<ProfileInfo *, ProfileInfo *> aAllProfileInformation;
    hr = ReadProfiles(aAllProfileInformation);

    if (SUCCEEDED(hr)) {
        for (int i = 0; i < aAllProfileInformation.GetSize(); ++i) {
            // default profiles have IDs betweeen 0 and 3000
            if (aAllProfileInformation[i]->GetID() > 0 && 
                aAllProfileInformation[i]->GetID() < DEFAULT_PROFILE_MAX)
                delete aAllProfileInformation[i];
            else 
                aProfileInformation.Add(aAllProfileInformation[i]);
        }
        aAllProfileInformation.RemoveAll();
    }

    return hr;
}
开发者ID:identity0815,项目名称:os45,代码行数:20,代码来源:ProfileUtils.cpp

示例8: OnDownBnClicked

void CFavoriteOrganizeDlg::OnDownBnClicked()
{
	CArray<int> selectedItems;
	POSITION pos = m_list.GetFirstSelectedItemPosition();
	int nItem;

	while (pos) {
		nItem = m_list.GetNextSelectedItem(pos);

		if (nItem < 0 || nItem >= m_list.GetItemCount() - 1) {
			return;
		}

		selectedItems.Add(nItem);
	}

	for (int i = selectedItems.GetSize() - 1; i >= 0; i--) {
		MoveItem(selectedItems[i], +1);
	}
}
开发者ID:Tphive,项目名称:mpc-be,代码行数:20,代码来源:FavoriteOrganizeDlg.cpp

示例9: GetColorFromColorButton

COLORREF CMainFrame::GetColorFromColorButton(int nButtonID)
{
	CArray<CMFCRibbonBaseElement*, CMFCRibbonBaseElement*> arButtons;

	m_wndRibbonBar.GetElementsByID(nButtonID, arButtons);

	if (arButtons.GetSize() == 0)
	{
		return(COLORREF) -1;
	}

	CMFCRibbonColorButton* pColorButton = (CMFCRibbonColorButton*)arButtons.GetAt(0);

	COLORREF clr = pColorButton->GetColor();
	if (clr == (COLORREF)-1)
	{
		clr = pColorButton->GetAutomaticColor();
	}

	return clr;
}
开发者ID:Ireneph,项目名称:samples,代码行数:21,代码来源:mainfrm.cpp

示例10: SetFonts

void InformApp::SendAllFrames(Changed changed, int value)
{
  if (changed == Preferences)
  {
    SetFonts();
    ClearScaledImages();
    ReportHtml::SetIEPreferences(NULL);
  }

  CArray<CFrameWnd*> frames;
  GetWindowFrames(frames);

  for (int i = 0; i < frames.GetSize(); i++)
  {
    CFrameWnd* frame = frames[i];
    if (frame->IsKindOf(RUNTIME_CLASS(ProjectFrame)))
      ((ProjectFrame*)frame)->SendChanged(changed,value);
    else if (frame->IsKindOf(RUNTIME_CLASS(ExtensionFrame)))
      ((ExtensionFrame*)frame)->SendChanged(changed,value);
  }
}
开发者ID:wyrover,项目名称:Windows-Inform7,代码行数:21,代码来源:Inform.cpp

示例11: PreTranslateMessage

BOOL InformApp::PreTranslateMessage(MSG* pMsg)
{
  if ((pMsg->hwnd == NULL) && DispatchThreadMessageEx(pMsg))
    return TRUE;

  CArray<CFrameWnd*> frames;
  GetWindowFrames(frames);

  CWnd* wnd = CWnd::FromHandle(pMsg->hwnd);
  for (int i = 0; i < frames.GetSize(); i++)
  {
    CFrameWnd* frame = frames[i];
    if (wnd->GetTopLevelParent() == frame)
      return CWnd::WalkPreTranslateTree(frame->GetSafeHwnd(),pMsg);
  }

  CWnd* mainWnd = AfxGetMainWnd();
  if (mainWnd != NULL)
    return mainWnd->PreTranslateMessage(pMsg);
  return FALSE;
}
开发者ID:wyrover,项目名称:Windows-Inform7,代码行数:21,代码来源:Inform.cpp

示例12: OnSelectPassenger

void CSelectPassenger::OnSelectPassenger()
{
	int selCount = listboxPassenger.GetSelCount();
	CArray<PassengerInfo>& passlist = CConfig::GetConfig().GetPassenger();
	CArray<int> selectedIndex;
	selectedIndex.SetSize(selCount);
	listboxPassenger.GetSelItems(selCount, selectedIndex.GetData());

	for(int i = 0; i < passlist.GetCount(); i++)
	{
		for(int j = 0; j < selectedIndex.GetCount(); j++)
		{
			CString str;
			listboxPassenger.GetText(selectedIndex[j], str);
			if(passlist[i].name == str)
			{
				selectedpass.Add(passlist[i]);
			}
		}
	}
}
开发者ID:AlexBu,项目名称:HTTPSClient,代码行数:21,代码来源:SelectPassenger.cpp

示例13: SearchMaxMin

//在src【】中寻找其中的最大值和最小值,number为src中元素的个数。
//bhasinited表示maxi和mini是否已经初始化了
void CSomeFuncs::SearchMaxMin( CArray<double, double>& src, double& maxi, double& mini, bool bHasInited )
{
    int number = src.GetSize();
    double* ptSrc = new double[number];
    for( int i = 0; i < number; i++ )
        ptSrc[i] = src[i];

    SearchMaxMin( ptSrc, number, maxi, mini, bHasInited );

    delete []ptSrc;

}
开发者ID:kanbang,项目名称:myexercise,代码行数:14,代码来源:SomeFuncs.cpp

示例14: HideAllChildViewExclude

//
// Function :
//     Hide all of child view, exclude the parameter specified.
//
void CChildView::HideAllChildViewExclude(const CWnd * pViewExclude)
{
	CArray <CWnd *> WndArray;
	INT_PTR ArraySize = 0;
	INT_PTR i = 0;

	// Add all of child view here
	WndArray.Add((CWnd *)this->m_pResultView);
	WndArray.Add((CWnd *)this->m_pSkuListView);

	ArraySize = WndArray.GetSize();

	for ( i = 0; i < ArraySize; i++ )
	{
		CWnd * pIterator = WndArray.GetAt(i);
		if (pIterator != pViewExclude)
		{
			pIterator->ShowWindow(SW_HIDE);
		}
	}
}
开发者ID:liyue80,项目名称:bpmps,代码行数:25,代码来源:ChildView.cpp

示例15: Add

BOOL ObjectDescription::Add(CArray <CString,CString&> &aListName,CMapStringToPtr &aListFind, CString csName0)
{
	CString csNAME=mUpper(csName0);
	if(!csNAME.IsEmpty())
	if(!aListFind[csNAME])
	{
		aListName.Add(csName0);
		aListFind[csNAME]=(void*)1;
		return TRUE;
	}
	return FALSE;
}
开发者ID:open2cerp,项目名称:Open2C-ERP,代码行数:12,代码来源:Metadata.cpp


注:本文中的CArray类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。