本文整理汇总了C++中CStringArray::SetSize方法的典型用法代码示例。如果您正苦于以下问题:C++ CStringArray::SetSize方法的具体用法?C++ CStringArray::SetSize怎么用?C++ CStringArray::SetSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CStringArray
的用法示例。
在下文中一共展示了CStringArray::SetSize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetFreeFunctionsInScripts
void GetFreeFunctionsInScripts(CStringArray & sNamesArray, LPCWSTR TransformationEvent)
{
// get an array with the available scripts
PluginArray * piScriptArray =
CAllThreadsScripts::GetActiveSet()->GetAvailableScripts(TransformationEvent);
// fill in these structures
int nFnc = 0;
int iScript;
for (iScript = 0 ; iScript < piScriptArray->GetSize() ; iScript++)
{
PluginInfo & plugin = piScriptArray->ElementAt(iScript);
LPDISPATCH piScript = plugin.m_lpDispatch;
BSTR * scriptNamesArray;
int * scriptIdsArray;
int nScriptFnc = GetMethodsFromScript(piScript, scriptNamesArray, scriptIdsArray);
sNamesArray.SetSize(nFnc+nScriptFnc);
int iFnc;
for (iFnc = 0 ; iFnc < nScriptFnc ; iFnc++)
// the CString = operator provides the conversion if UNICODE is not defined
sNamesArray[nFnc+iFnc] = scriptNamesArray[iFnc];
delete [] scriptIdsArray;
delete [] scriptNamesArray;
nFnc += nScriptFnc;
}
}
示例2: PreTranslateMessage
BOOL CAppealDlg::PreTranslateMessage(MSG* pMsg)
{
// TODO: 在此添加专用代码和/或调用基类
CBcfFile fMsg(CBcfFile::GetAppPath()+"ClientMessage.bcf");
if (pMsg->message == WM_USER + 1)
{
if (pMsg->wParam == 1 || pMsg->wParam == 5)
{
//wushuqun 2009.5.22
//AFCMessageBox(fMsg.GetKeyVal("AppealDlg","SendAppealError","投诉文件上传失败!"));
DUIMessageBox(m_hWnd,MB_ICONINFORMATION|MB_OK,"系统提示",false,fMsg.GetKeyVal("AppealDlg","SendAppealError","投诉文件上传失败!"));
return CDialog::PreTranslateMessage(pMsg);
}
if (m_strInfoFileName == "" || m_strInfoFileWholeName == "")
{
return CDialog::PreTranslateMessage(pMsg);
}
if (pMsg->wParam == 4) //当zxh录像文件输送成功后,再传送txt文件
{
CStringArray csa;
csa.SetSize(0,6);
csa.Add(m_strFtpAddress);
csa.Add(m_strFtpUserName);
csa.Add(m_strFtpPwd);
csa.Add(m_strInfoFileName); //远程文件名字
csa.Add(m_strInfoFileWholeName); //本地文件名字
int b=UploadFile(&csa,this->m_hWnd,WM_USER+2);
}
}
else if(pMsg->message == WM_USER + 2)
{
if (pMsg->wParam == 1 || pMsg->wParam == 5)
{
//wushuqun 2009.5.22
//AFCMessageBox(fMsg.GetKeyVal("AppealDlg","SendAppealError","投诉文件上传失败!"));
DUIMessageBox(m_hWnd,MB_ICONINFORMATION|MB_OK,"系统提示",false,fMsg.GetKeyVal("AppealDlg","SendAppealError","投诉文件上传失败!"));
return CDialog::PreTranslateMessage(pMsg);
}
if (pMsg->wParam == 4)
{
//AFCMessageBox(fMsg.GetKeyVal("AppealDlg","SendAppealSuccess","投诉文件已经上传成功!"));
DUIMessageBox(m_hWnd,MB_ICONINFORMATION|MB_OK,"系统提示",false,fMsg.GetKeyVal("AppealDlg","SendAppealSuccess","投诉文件已经上传成功!"));
}
//删除产生的中间文件
//
//删除生成的信息文件
::DeleteFile(m_strInfoFileWholeName);
m_strInfoFileName = "";
m_strInfoFileWholeName = "";
}
return CDialog::PreTranslateMessage(pMsg);
}
示例3: GetSelectedItems
void CFileBrowserListCtrl::GetSelectedItems(CStringArray& Path) const
{
int selcnt = GetSelectedCount();
Path.SetSize(selcnt);
POSITION pos = GetFirstSelectedItemPosition();
for (int i = 0; i < selcnt; i++)
Path[i] = GetItemPath(GetNextSelectedItem(pos));
}
示例4: LoadStringArray
// ============================================================================
void LoadStringArray(CArchive &ar, CStringArray &strArr)
{
int count;
ar >> count;
strArr.SetSize(count);
for(int i = 0; i < count; i++)
ar >> strArr[i];
}
示例5: Read
BOOL CRegistry::Read (LPCTSTR pszKey, CStringArray& scArray)
{
ASSERT(m_hKey);
const int iMaxChars = 4096;
int OldSize = (int) scArray.GetSize();
DWORD dwType;
DWORD dwData = iMaxChars;
BYTE* byData = (BYTE*)::calloc(iMaxChars, sizeof(TCHAR));
ASSERT(byData);
LONG lReturn = RegQueryValueEx(m_hKey, pszKey, NULL, &dwType,
byData, &dwData);
m_Info.lMessage = lReturn;
m_Info.dwType = dwType;
m_Info.dwSize = dwData;
if(lReturn == ERROR_SUCCESS && dwType == REG_BINARY)
{
ASSERT(dwData < iMaxChars);
CMemFile file(byData, dwData);
CArchive ar(&file, CArchive::load);
ar.m_bForceFlat = FALSE;
ASSERT(ar.IsLoading());
ASSERT(scArray.IsSerializable());
scArray.RemoveAll();
scArray.SetSize(10);
scArray.Serialize(ar);
scArray.SetSize(OldSize);
ar.Close();
file.Close();
}
if(byData)
{
free(byData);
byData = NULL;
}
if(lReturn == ERROR_SUCCESS)
return TRUE;
return FALSE;
}
示例6: GetLastEditScript
BOOL GetLastEditScript(CStringArray &anArray)
{
int i;
anArray.RemoveAll();
if (!m_bEditScriptValid) return FALSE;
anArray.SetSize(m_EditScript.GetSize());
for (i=0; i<m_EditScript.GetSize(); i++) anArray.SetAt(i, m_EditScript.GetAt(i));
return TRUE;
}
示例7: OnPreparePrinting
BOOL CCollegeTimeTableView::OnPreparePrinting(CPrintInfo* pInfo)
{pInfo->SetMinPage(1);
CString temp,temp2;
CStringArray arr;
arr.SetSize(20); //// for parallel lecture splitting in diff strings
int height,maxheight;
int LineCounter=0,PageIndex=0;
PageArray.RemoveAll(); ////// Reset Page Description Array
CPage tempage;
PageArray.Add(tempage);
BOOL bLastEmpty=FALSE;
for(int i=1;i<ROWS;i++) ////// Preapre Page Description
{maxheight=1;
temp=m_master.GetItemText(i,0);
if(temp.IsEmpty()){ if(i+1<ROWS) { temp2=m_master.GetItemText(i+1,0);
if(temp2[0]>='0' && temp2[0]<='9')
continue;///no blank line before time cell
///since onprint() will create one
}
if(bLastEmpty) continue; /// keep atmost one empty row
if((LineCounter+1)<LinesPerPage)
{LineCounter++;
PageArray[PageIndex].Line.Add(i);
bLastEmpty=TRUE;
continue;
}
else
{PageIndex++;
PageArray.Add(tempage);
LineCounter=0;
continue;
}
}
bLastEmpty=FALSE;
GetParallelLectureList(temp,arr);// Get Parallel lectures in CStringarray arr
height=arr.GetSize();
if(height<1) height=1;
if(height>maxheight) maxheight=height; ///max cell height,>1 for parallel lectures
if((LineCounter+maxheight)<LinesPerPage)
{LineCounter+=maxheight; //include lines
PageArray[PageIndex].Line.Add(i); continue; ///go for more lines
}
PageIndex++; /// Page Full, go for next page
PageArray.Add(tempage);///Create Empty Page Struct
LineCounter=maxheight; ///
PageArray[PageIndex].Line.Add(i);
}
pInfo->SetMaxPage(PageIndex+1);
return DoPreparePrinting(pInfo);
}
示例8: MoveTo
int CReportCtrl::MoveTo(int nItem, int nNewPosition)
{
if(!_IsValidIndex(nItem))
{
return(-1);
}
EndEdit(TRUE);
const int ITEMS = CListCtrl :: GetItemCount();
nNewPosition = max(0, nNewPosition);
nNewPosition = min(ITEMS - 1, nNewPosition);
if(nItem == nNewPosition)
{
return(nNewPosition);
}
_UnsetSortedColumn();
// Backup all states and attributes
const int COLS = GetColumnCount();
const DWORD STATES = GetItemStates(nItem);
const DWORD DATA = CListCtrl :: GetItemData(nItem);
CArray<int, int> aImages;
CStringArray aTexts;
aImages.SetSize(COLS);
aTexts.SetSize(COLS);
for(int i = 0; i < COLS; i++)
{
aImages[i] = GetItemImage(nItem, i);
aTexts[i] = GetItemText(nItem, i);
}
// Delete the item
CListCtrl :: DeleteItem(nItem);
// Insert a new item to the new position
const int IDX = CListCtrl :: InsertItem(nNewPosition, _T(""));
// Restore all states & attributes to the newly inserted item
for(int j = 0; j < COLS; j++)
{
CListCtrl :: SetItemText(IDX, j, aTexts[j]);
SetItemImage(IDX, j, aImages[j]);
}
CListCtrl :: SetItemData(IDX, DATA);
SetItemStates(IDX, STATES);
return(IDX);
}
示例9: SearchLibraries
/**
* Searches for all available libraries in the library path
*
* @param
* @return
* @exception -
* @see
*/
HRESULT CProjectWizardData::SearchLibraries()
{
BOOL done;
int iCount,iNumberLibraries;
HRESULT hrResult;
HANDLE hSearch;
WIN32_FIND_DATA findData;
CString sSearch;
CStringArray asLibraries;
iNumberLibraries = 0;
asLibraries.SetSize(0);
m_Libraries.RemoveAll ();
hrResult = UTIL_GetStdLibPath (m_strLibraryPath.GetBuffer(_MAX_PATH), _MAX_PATH);
m_strLibraryPath.ReleaseBuffer();
if (SUCCEEDED(hrResult)) {
if (m_strLibraryPath.IsEmpty()) {
hrResult = S_FALSE;
} else {
sSearch.Format(_T("%s\\*.") FILE_EXT_LIBRARY,m_strLibraryPath);
hSearch = FindFirstFile(sSearch,&findData);
if (hSearch == INVALID_HANDLE_VALUE) {
hrResult = S_FALSE;
} else {
hrResult = S_OK;
done = FALSE;
while (! done) {
asLibraries.SetAtGrow(iNumberLibraries,CString(findData.cFileName));
iNumberLibraries++;
if (! done) {
done = ! FindNextFile(hSearch,&findData);
if (done) {
if (GetLastError() != ERROR_NO_MORE_FILES) {
hrResult = E_FAIL;
}
}
}
}
FindClose(hSearch);
if (hrResult == S_OK) {
m_Libraries.SetSize(iNumberLibraries);
for (iCount=0; iCount<iNumberLibraries; iCount++) {
m_Libraries[iCount].SetLibraryName(asLibraries[iCount]);
m_Libraries[iCount].SetSelectFlag(FALSE);
}
}
}
}
}
return hrResult;
}
示例10: SwapRow
BOOL CListCtrlEx::SwapRow(int nRow1, int nRow2)
{
BOOL bOk = FALSE;
int nMaxRows = GetItemCount();
if ( (nRow1 >= 0) && (nRow1 < nMaxRows) && (nRow2 >= 0) && (nRow2 < nMaxRows) && (nRow1 != nRow2) )
{
int nMaxColumns = GetColumnCount();
LV_ITEM lvItem1, lvItem2;
CStringArray rowText;
rowText.SetSize(nMaxColumns);
for(int i = 0; i < nMaxColumns; i++)
{
rowText[i] = GetItemText(nRow1, i);
}
lvItem1.mask = LVIF_IMAGE | LVIF_PARAM | LVIF_STATE;
lvItem1.iItem = nRow1;
lvItem1.iSubItem = 0;
lvItem1.stateMask = LVIS_CUT | LVIS_DROPHILITED | LVIS_FOCUSED | LVIS_SELECTED | LVIS_OVERLAYMASK | LVIS_STATEIMAGEMASK;
lvItem2 = lvItem1;
lvItem2.iItem = nRow2;
GetItem(&lvItem1);
GetItem(&lvItem2);
for(i = 0; i < nMaxColumns; i++)
{
CListCtrl::SetItemText(nRow1, i, GetItemText(nRow2, i));
}
lvItem2.iItem = nRow1;
SetItem(&lvItem2);
for(i = 0; i < nMaxColumns; i++)
{
CListCtrl::SetItemText(nRow2, i, rowText[i]);
}
lvItem1.iItem = nRow2;
SetItem(&lvItem1);
}
return bOk;
}
示例11: CComboBox_CopyTo
void CComboBox_CopyTo(const CComboBox &ctrlComboBox, CStringArray &arrstrItems)
{
ASSERT(ctrlComboBox.GetSafeHwnd() != NULL);
arrstrItems.RemoveAll();
arrstrItems.SetSize(ctrlComboBox.GetCount());
CString strItem;
for (int i = 0; i < ctrlComboBox.GetCount(); ++i)
{
ctrlComboBox.GetLBText(i, strItem);
arrstrItems[i] = strItem;
}
}
示例12: OnPrint
void CCollegeTimeTableView::OnPrint(CDC* pDC, CPrintInfo* pInfo)
{ int j,k,height,maxheight;
UINT line;
CString temp;
CStringArray arr;
arr.SetSize(20);
CFont fon;
CFont* oldfont;
fon.CreateFont(18,8,0,0,FW_NORMAL,0,0,0,ANSI_CHARSET,OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH | FF_SWISS,"COURIER NEW");
oldfont=pDC->SelectObject(&fon);
pDC->SetMapMode(MM_LOENGLISH);
pDC->SetBkMode(TRANSPARENT);
CPoint PP(70,-25);
CPoint QQ(771,-25);
CPoint tempPP,tempQQ;
UINT lastline=PageArray[(pInfo->m_nCurPage)-1].Line.GetUpperBound();///
for(line=0;line<=lastline;line++)
{ maxheight=1;
for(j=0;j<7;j++)
{tempPP=PP;//tempQQ=QQ;
temp=m_master.GetItemText(PageArray[(pInfo->m_nCurPage)-1].Line[line],j);
if(temp[0]>='0' && temp[0]<='9')
{PP.Offset(0,-25);
tempPP=PP;QQ.Offset(0,-25); /////create blank space between lecture blocks
}
GetParallelLectureList(temp,arr);// in CStringarray arr
height=arr.GetSize();
if(height<1) height=1;
if(height>maxheight) maxheight=height;
for(k=0;k<height;k++)
{pDC->TextOut(74+j*100,PP.y-2,arr[k]);
PP.Offset(0,-25);
}
PP=tempPP;//Reset to normal lecture line
}
QQ.Offset(0,-25*maxheight);
DisplayGrid(PP,QQ,1,7,pDC);
PP.Offset(0,-25*maxheight);
}
pDC->SelectObject(&oldfont);
}
示例13: OnBnClickedOk
void CReportDlg::OnBnClickedOk()
{
if(!m_pPlayerDB)
return;
CFileDialog dlg(FALSE, _T(".csv"), _T("stat.csv"), OFN_OVERWRITEPROMPT, _T("CSV (Comma delimited, *.csv)|*.csv||"));
if(dlg.DoModal() == IDCANCEL)
return;
CString csvfile = dlg.GetPathName();
CCsvFile csv(csvfile, CFile::modeWrite | CFile::modeCreate);
CStringArray a;
const CHeaderCtrl * header = m_List.GetHeaderCtrl();
int i;
HDITEM hdi;
enum { sizeOfBuffer = 256 };
TCHAR lpBuffer[sizeOfBuffer];
hdi.mask = HDI_TEXT;
hdi.pszText = lpBuffer;
hdi.cchTextMax = sizeOfBuffer;
a.SetSize(header->GetItemCount());
for(i = 0; i < header->GetItemCount(); i++)
{
header->GetItem(i, &hdi);
a[i] = lpBuffer;
}
csv.WriteLine(a);
for(int i = 0; i < m_List.GetItemCount(); i++)
{
#ifdef XLISTCTRL_OLD
for(int j = 0; j < m_List.GetColumnCount(); j++)
#else
for(int j = 0; j < m_List.GetColumns(); j++)
#endif
a[j] = m_List.GetItemText(i, j);
csv.WriteLine(a);
}
OnOK();
}
示例14: SortExtensionData
void CDirstatDoc::SortExtensionData(CStringArray& sortedExtensions)
{
sortedExtensions.SetSize(m_extensionData.GetCount());
int i= 0;
POSITION pos= m_extensionData.GetStartPosition();
while (pos != NULL)
{
CString ext;
SExtensionRecord r;
m_extensionData.GetNextAssoc(pos, ext, r);
sortedExtensions[i++]= ext;
}
_pqsortExtensionData= &m_extensionData;
qsort(sortedExtensions.GetData(), sortedExtensions.GetSize(), sizeof(CString), &_compareExtensions);
_pqsortExtensionData= NULL;
}
示例15: Combine
void Combine(CStringArray& aszX, CString s, int k,CStringArray& aszC)
{
if(aszX.GetSize() > 10)
{
AfxMessageBox("So to hop qua lon",MB_OK);
aszX.SetSize(10);
}
int i,j;
CStringArray aszTemp;
for(i=k; i<aszX.GetSize(); i++)
{
aszTemp.Add(s + aszX[i]);
aszC.Add(Union(s , aszX[i]));
}
k++;
for(j=0; j<aszTemp.GetSize(); j++)
Combine(aszX,aszTemp[j],j+k,aszC);
}