本文整理汇总了C++中CArray::SetAtGrow方法的典型用法代码示例。如果您正苦于以下问题:C++ CArray::SetAtGrow方法的具体用法?C++ CArray::SetAtGrow怎么用?C++ CArray::SetAtGrow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CArray
的用法示例。
在下文中一共展示了CArray::SetAtGrow方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CheckImages
DWORD WINAPI CheckImages(LPVOID pData)
{
iMode=0;
bStopCheck=0;
bStopLoad=0;
lDeletedFiles=0;
// Первый этап - сбор дибов
CSize aMins(100,100);
CDesktopDC dcDesk;
int iSize=sListOfImages.GetSize();
for(int zi=0;zi<iSize;zi++){
aClosestImage.SetAtGrow(zi,-1);
aClosestImageTaken.SetAtGrow(zi,0);
}
/*CSplashParams* sp=0;
CSplashWindow* sw=0;
if(!hDiag){
sp=new CSplashParams();
sp->szText="Reading...";
sp->bgColor=0;
sp->txColor=RGB(255,255,255);
sp->dwTextParams|=TXSHADOW_VCENT|TXSHADOW_FILLBG|TXSHADOW_WIDE|TXSHADOW_GLOW|TXSHADOW_MIXBG;////TXSHADOW_SHCOL
sp->dwSplashAlign=SPLASH_OPACITY;
sp->dwSplashAlign|=SPLASH_HLEFT;
sp->dwSplashAlign|=SPLASH_VTOP;
sw=new CSplashWindow(sp);
}*/
{
CDesktopDC dcDesk;
CDC dc;
dc.CreateCompatibleDC(&dcDesk);
CDC dc2;
dc2.CreateCompatibleDC(&dcDesk);
dc.SetStretchBltMode(HALFTONE);
dc2.SetStretchBltMode(HALFTONE);
CSmartLock cs(csCheck,TRUE);
for(int i=0;i<iSize;i++){
if(bStopCheck){
break;
}
if(bStopLoad){
iMode=1;
break;
}
if(hDiag){
::SetWindowText(hDiag,Format("%i%%, %s",long(100*i/double(iSize)),_l("Preparations")));
::SetWindowText(GetDlgItem(hDiag,IDC_STATUS),Format(" %s #%i/%i...",_l("Preparing image"),i,iSize));
}
sListOfImageDibs.SetAtGrow(i,0);
CBitmap* bmp=_bmpX()->LoadBmpFromPath(sListOfImages[i]);
CSize size2=GetBitmapSize(bmp);
if(bmp){
{// Занести обратно
//HBITMAP hSmall=0;
// CopyBitmapToBitmap(*bmp,hSmall,CSize(0,0),&aMins,-1);
CBitmap bmpSmall;
bmpSmall.CreateCompatibleBitmap(&dc,aMins.cx,aMins.cy);
CBitmap* bmpTmp=dc.SelectObject(bmp);
CBitmap* bmpTmp2=dc2.SelectObject(&bmpSmall);
dc2.StretchBlt(0,0,aMins.cx,aMins.cy,&dc,0,0,size2.cx,size2.cy,SRCCOPY);
dc2.SelectObject(&bmpTmp2);
dc.SelectObject(&bmpTmp);
CDib* pDib=new CDib();
if(pDib){
pDib->Create(aMins.cx,aMins.cy);
pDib->SetBitmap(&dc2,bmpSmall);
sListOfImageDibs.SetAtGrow(i,pDib);
}
//DeleteObject(hSmall);
}
_bmpX()->ReleaseBmp(bmp);
}
}
if(!bStopCheck){
iMode=1;
if(hDiag){
::SetWindowText(GetDlgItem(hDiag,ID_NEXT),_l("Next image pair"));
::EnableWindow(GetDlgItem(hDiag,ID_NEXT),TRUE);
::SetWindowText(GetDlgItem(hDiag,IDC_STATUS),CString(" ")+_l("Looking for duplicates")+"...");
::EnableWindow(GetDlgItem(hDiag,IDC_IMGR_DEL_ALL),TRUE);
::PostMessage(hDiag,WM_COMMAND,ID_NEXT,0);
}
}
}
/*
if(sp){
delete sp;
}
if(sw){
delete sw;
}
*/
return 0;
};
示例2: PopulateTreeFromFileSystem
//.........这里部分代码省略.........
// TODO: empty
return;
}
CArray<CStringW, LPCWSTR> saDirs;
// guess that we will have 32 sub dirs (the array will grow if we have more)
saDirs.SetSize(32);
// keep track of the number of dirs we have actually found
int nDirsFound = 0;
do
{
if ((FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
continue;
// eliminate . and .. from the search
if (FindData.cFileName[0] == '.')
{
if (FindData.cFileName[1] == '\0')
{
continue;
}
else if (FindData.cFileName[1] == '.' && FindData.cFileName[2] == '\0')
{
continue;
}
}
// convert to lower case
CStringW sTempFileName = FindData.cFileName;
sTempFileName.MakeLower();
// only add to the collection if we don't already know about it
if (KnownDirs.find(sTempFileName) != KnownDirs.end())
continue;
// if it's a known ignore dir name - then ignore it
if (IgnoreDirNames.find(sTempFileName) != IgnoreDirNames.end())
continue;
#ifdef _DEBUG
ATLTRACE2(L"CIISConfigHelper::PopulateTreeFromFileSystem() : found '%s'\n", FindData.cFileName);
#endif
saDirs.SetAtGrow(nDirsFound, FindData.cFileName);
// we have found one
nDirsFound++;
}
while (::FindNextFileW(hFind, &FindData) == TRUE);
// get rid of the find handle
::FindClose(hFind);
hFind = NULL;
if (nDirsFound <= 0)
{
return;
}
if (nMaxDepth <= 0)
{
cTree.InsertItem(EmptyNodeString, htParent);
return;
}
for (int i = 0; i < nDirsFound; i++)
{
CString sDir(saDirs[i]);
HTREEITEM htChild = cTree.InsertItem(sDir, htParent);
// create the child file system path
CPathT<CStringW> FileSystemPath(pParentItem->sFileSystemPath);
FileSystemPath.Append(saDirs[i]);
// we need an item data for this tree item
IISURIItem* pChildItem = new IISURIItem;
pChildItem->Type = IISURIItem::FileSystem;
pChildItem->sFileSystemPath = (LPCWSTR) FileSystemPath;
// make the child URI
CStringW sChildURI = pParentItem->sURI;
int nChildURILength = sChildURI.GetLength();
if (nChildURILength > 0 && sChildURI[nChildURILength - 1] != '/')
sChildURI += '/';
// append the dir name
sChildURI += saDirs[i];
// assign the URI to the item data
pChildItem->sURI = sChildURI;
// store the item data
cTree.SetItemData(htChild, (DWORD_PTR) pChildItem);
PopulateTreeFromFileSystem(cTree, htChild, IgnoreDirNames, nMaxDepth - 1);
}
}