本文整理汇总了C++中CStringList::GetCount方法的典型用法代码示例。如果您正苦于以下问题:C++ CStringList::GetCount方法的具体用法?C++ CStringList::GetCount怎么用?C++ CStringList::GetCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CStringList
的用法示例。
在下文中一共展示了CStringList::GetCount方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FindIncludeFile
CString FindIncludeFile( const TCHAR *pszIncludeFilename, const TCHAR *pszIncludePath )
{
CString strEnvInclude;
CStringList strrgPathList;
if( FileExists( pszIncludeFilename ) )
return CString(pszIncludeFilename);
// add current directory to path list;
strrgPathList.AddTail( ".\\" );
// add path specified in the command line (/I option)
if( pszIncludePath )
AddPath( strrgPathList, pszIncludePath );
// add path specified in the INCLUDE variable
if( strEnvInclude.GetEnvironmentVariable( _T("INCLUDE") ) )
AddPath( strrgPathList, strEnvInclude );
POSITION pos = strrgPathList.GetHeadPosition();
for (int i=0;i < strrgPathList.GetCount();i++)
{
CString strPath = strrgPathList.GetNext(pos);
CString tmp = strPath.Right(1);
if( tmp != ":" && tmp != "\\" )
strPath += '\\';
strPath += pszIncludeFilename;
if( FileExists( strPath ) )
return CString(strPath);
}
return CString("");
}
示例2: execute
BOOL CCmdColor::execute(CString ¶ms)
{
// Decode parameters
CStringList paramStrList;
CScriptParser::StringSplit(paramStrList, params, CString( ' ' ));
// Need at least 3 params for r, g, b
const int numParams = 3;
if(paramStrList.GetCount() < numParams)
{
return FALSE;
}
float channels[numParams];
POSITION pos = paramStrList.GetHeadPosition();
for(int i = 0; i < numParams; ++i)
{
CString paramStr = paramStrList.GetNext(pos);
channels[i] = (float)wcstod(paramStr, NULL);
}
CRasterizer::Instance()->SetColor(channels[0], channels[1], channels[2]);
return TRUE;
}
示例3: execute
BOOL CCmdDrawPixel::execute(CString ¶ms)
{
// Decode parameters
CStringList paramStrList;
CScriptParser::StringSplit(paramStrList, params, CString( ' ' ));
// Need at least 2 params for x, y
const int numParams = 2;
if(paramStrList.GetCount() < numParams)
{
return FALSE;
}
int coords[numParams];
POSITION pos = paramStrList.GetHeadPosition();
for(int i = 0; i < numParams; i++)
{
CString paramStr = paramStrList.GetNext(pos);
coords[i] = (int)(wcstod(paramStr, NULL) + 0.5f);
}
CRasterizer::Instance()->DrawPoint(coords[0], coords[1]);
return TRUE;
}
示例4: OnContextMenu
void CLibraryFileView::OnContextMenu(CWnd* /*pWnd*/, CPoint point)
{
GetToolTip()->Hide();
CStringList oFiles;
{
CQuickLock pLock( Library.m_pSection );
POSITION posSel = StartSelectedFileLoop();
while ( CLibraryFile* pFile = GetNextSelectedFile( posSel ) )
{
oFiles.AddTail( pFile->GetPath() );
}
}
if ( oFiles.GetCount() == 0 )
{
// No files were selected, try folder itself
if ( CLibraryTreeItem* pRoot = GetFolderSelection() )
{
if ( pRoot->m_pPhysical )
oFiles.AddTail( pRoot->m_pPhysical->m_sPath );
}
}
if ( point.x == -1 && point.y == -1 ) // Keyboard fix
ClientToScreen( &point );
CString strName( m_pszToolBar );
// strName += Settings.Library.ShowVirtual ? _T(".Virtual") : _T(".Physical"); // For now, CLibraryFileView.Virtual = CLibraryFileView.Physical
Skin.TrackPopupMenu( strName, point, ID_LIBRARY_LAUNCH, oFiles );
}
示例5: GetMaxStringWidth
// v7.2 - update 03 - added for mods to StartDropList - adjust
// droplist to width of text - Allen Shiels
int CUGDropListType::GetMaxStringWidth(const CStringList& list) const
{
int maxWidth = 0;
CDC* pDC = m_listBox->GetDC();
CFont* pFont = m_listBox->GetFont();
CFont* pOldFont = pDC->SelectObject(pFont); // Loop through each item in the list calculating // the text extent for each string in the list box font
int len = (int)list.GetCount();
POSITION position = list.GetHeadPosition();
int pos = 0;
while(pos < len)
{
CSize sz = pDC->GetTextExtent(list.GetAt(position));
if (sz.cx > maxWidth)
maxWidth = sz.cx;
pos++;
if(pos < len)
list.GetNext(position);
}
pDC->SelectObject(pOldFont);
m_listBox->ReleaseDC(pDC);
return maxWidth + 10; // + a bit to stop clipping
}
示例6: ScriptSetPopulator
void __cdecl ScriptSetPopulator(TestSet *pTestSet)
{
// TODO read from registry
CString szTestDir(_T("Scripts"));
CStringList cStringList;
CFileFind cFinder;
CString szPattern;
szPattern.Format(_T("%s\\*.vbs"), szTestDir);
BOOL bWorking = cFinder.FindFile(szPattern);
while (bWorking)
{
bWorking = cFinder.FindNextFile();
cStringList.AddTail(cFinder.GetFileName());
}
szPattern.Format(_T("%s\\*.js"), szTestDir);
bWorking = cFinder.FindFile(szPattern);
while (bWorking)
{
bWorking = cFinder.FindNextFile();
cStringList.AddTail(cFinder.GetFileName());
}
// Create a set of tests from the scripts found
Test *pTests = (Test *) malloc(sizeof(Test) * cStringList.GetCount());
for (int i = 0; i < cStringList.GetCount(); i++)
{
CString szScript = cStringList.GetAt(cStringList.FindIndex(i));
_tcscpy(pTests[i].szName, szScript);
_tcscpy(pTests[i].szDesc, _T("Run the specified script"));
pTests[i].pfn = tstScriptTest;
}
pTestSet->nTests = cStringList.GetCount();
pTestSet->aTests = pTests;
}
示例7: ListToString
// takes a list of strings and converts it to a string like "apples,peaches,pears"
void ListToString (const CStringList & thelist, const char delim, CString & str)
{
int iCount = 0;
str.Empty ();
if (thelist.IsEmpty ())
return;
for (POSITION pos = thelist.GetHeadPosition (); pos; )
{
str += thelist.GetNext (pos);
if (++iCount < thelist.GetCount ())
str += delim;
} // end of getting each one
} // end of ListToString
示例8: OnLoad
LONG CuDlgReplicationServerPageAssignment::OnLoad (WPARAM wParam, LPARAM lParam)
{
LPCTSTR pClass = (LPCTSTR)wParam;
ASSERT (lstrcmp (pClass, _T("CaReplicationServerDataPageAssignment")) == 0);
CTypedPtrList<CObList, CStringList*>* pListTuple;
CaReplicationServerDataPageAssignment* pData = (CaReplicationServerDataPageAssignment*)lParam;
ASSERT (pData);
if (!pData)
return 0L;
pListTuple = &(pData->m_listTuple);
CStringList* pObj = NULL;
POSITION p, pos = pListTuple->GetHeadPosition();
try
{
// For each column:
const int LAYOUT_NUMBER = 5;
for (int i=0; i<LAYOUT_NUMBER; i++)
m_cListCtrl.SetColumnWidth(i, pData->m_cxHeader.GetAt(i));
int nCount;
while (pos != NULL)
{
pObj = pListTuple->GetNext (pos);
ASSERT (pObj);
ASSERT (pObj->GetCount() == 5);
nCount = m_cListCtrl.GetItemCount();
p = pObj->GetHeadPosition();
m_cListCtrl.InsertItem (nCount, (LPCTSTR)pObj->GetNext(p));
m_cListCtrl.SetItemText (nCount, 1, (LPCTSTR)pObj->GetNext(p));
m_cListCtrl.SetItemText (nCount, 2, (LPCTSTR)pObj->GetNext(p));
m_cListCtrl.SetItemText (nCount, 3, (LPCTSTR)pObj->GetNext(p));
m_cListCtrl.SetItemText (nCount, 4, (LPCTSTR)pObj->GetNext(p));
}
m_cListCtrl.SetScrollPos (SB_HORZ, pData->m_scrollPos.cx);
m_cListCtrl.SetScrollPos (SB_VERT, pData->m_scrollPos.cy);
}
catch (CMemoryException* e)
{
theApp.OutOfMemoryMessage();
e->Delete();
}
return 0L;
}
示例9: Process
void vmsFilesToDelete::Process()
{
CStringList sl;
_App.FilesToDelete (sl);
for (int i = sl.GetCount () - 1; i >= 0; i--)
{
LPCTSTR psz = sl.GetAt (sl.FindIndex (i));
BOOL bOK = TRUE;
if (GetFileAttributes (psz) != DWORD (-1))
bOK = DeleteFile (psz);
if (bOK)
sl.RemoveAt (sl.FindIndex (i));
}
_App.FilesToDelete_save (sl);
}
示例10: getValues
bool CRegistryKey::getValues(CStringList& values)
{
values.RemoveAll();
if (RegOpenKeyEx(m_base, m_path, 0, KEY_EXECUTE|m_sam, &m_hKey)==ERROR_SUCCESS)
{
for (int i = 0, rc = ERROR_SUCCESS; rc == ERROR_SUCCESS; ++i)
{
TCHAR value[255];
DWORD size = _countof(value);
rc = RegEnumValue(m_hKey, i, value, &size, NULL, NULL, NULL, NULL);
if (rc == ERROR_SUCCESS)
{
values.AddTail(value);
}
}
}
return values.GetCount() > 0;
}
示例11: getSubKeys
bool CRegistryKey::getSubKeys(CStringList& subkeys)
{
subkeys.RemoveAll();
if (RegOpenKeyEx(m_base, m_path, 0, KEY_EXECUTE|m_sam, &m_hKey)==ERROR_SUCCESS)
{
for (int i = 0, rc = ERROR_SUCCESS; rc == ERROR_SUCCESS; ++i)
{
TCHAR value[1024];
DWORD size = _countof(value);
FILETIME last_write_time;
rc = RegEnumKeyEx(m_hKey, i, value, &size, NULL, NULL, NULL, &last_write_time);
if (rc == ERROR_SUCCESS)
{
subkeys.AddTail(value);
}
}
}
return subkeys.GetCount() > 0;
}
示例12: SortList
//ÅÅÐò½Ó¿Úº¯Êý(bAsc=TRUEÉýÐò)
void SortList(CStringList &KeyList, CStringList &ValList, BOOL bAsc)
{
int Count = KeyList.GetCount();
_rec *r = new _rec[Count*sizeof(_rec)];
POSITION posKey = KeyList.FindIndex(0);
POSITION posVal = ValList.FindIndex(0);
int i=0;
while(posKey && posVal)
{
CString Key = KeyList.GetNext(posKey);
CString Val = ValList.GetNext(posVal);
r[i].key = Key;
r[i].val = Val;
i++;
}
//ÅÅÐòº¯Êý
_Sort(r,Count,bAsc);
KeyList.RemoveAll();
ValList.RemoveAll();
for(int j=0; j<Count; j++)
{
CString s1 = r[j].key;
CString s2 = r[j].val;
KeyList.AddTail(r[j].key);
ValList.AddTail(r[j].val);
}
delete[] r;
}
示例13: FromFile
//.........这里部分代码省略.........
if (!wcscmp(pChild->szKey, L"StringFileInfo"))
{
//It is a StringFileInfo
//ASSERT(1 == pChild->wType);
//如果类型是0表示二进制内容,类型为1时才包含字符串内容
if (1 != pChild->wType)
{
//pChild = (BaseFileInfo*)DWORDALIGN((DWORD)pChild + pChild->wLength);
//continue;
}
StringFileInfo* pStringFI = (StringFileInfo*)pChild;
ASSERT(!pStringFI->wValueLength);
//MSDN says: Specifies an array of zero or one StringFileInfo structures. So there should be only one StringFileInfo at most
ASSERT(m_stringFileInfo.IsEmpty());
m_stringFileInfo.FromStringFileInfo(pStringFI);
bHasStrings = TRUE;
}
else
{
VarFileInfo* pVarInfo = (VarFileInfo*)pChild;
//ASSERT(1 == pVarInfo->wType);
//如果类型是0表示二进制内容,类型为1时才包含字符串内容
if (1 != pChild->wType)
{
//pChild = (BaseFileInfo*)DWORDALIGN((DWORD)pChild + pChild->wLength);
//continue;
}
ASSERT(!wcscmp(pVarInfo->szKey, L"VarFileInfo"));
ASSERT(!pVarInfo->wValueLength);
//Iterate Var elements
//There really must be only one
Var* pVar = (Var*) DWORDALIGN(&pVarInfo->szKey[wcslen(pVarInfo->szKey)+1]);
while ((DWORD)pVar < ((DWORD) pVarInfo + pVarInfo->wLength))
{
ASSERT(!bHasVar && "Multiple Vars in VarFileInfo");
ASSERT(!wcscmp(pVar->szKey, L"Translation"));
ASSERT(pVar->wValueLength);
DWORD *pValue = (DWORD*) DWORDALIGN(&pVar->szKey[wcslen(pVar->szKey)+1]);
DWORD *pdwTranslation = pValue;
while ((LPBYTE)pdwTranslation < (LPBYTE)pValue + pVar->wValueLength)
{
CString strStringTableKey;
strStringTableKey.Format(_T("%04x%04x"), LOWORD(*pdwTranslation), HIWORD(*pdwTranslation));
lstTranslations.AddTail(strStringTableKey);
pdwTranslation++;
}
bHasVar = TRUE;
pVar = (Var*) DWORDALIGN((DWORD)pVar + pVar->wLength);
}
ASSERT(bHasVar && "No Var in VarFileInfo");
}
if (!bBlockOrderKnown)
{
bBlockOrderKnown = TRUE;
m_bRegularInfoOrder = bHasStrings;
}
pChild = (BaseFileInfo*) DWORDALIGN((DWORD)pChild + pChild->wLength);
}
#ifdef _DEBUG
ASSERT((DWORD)lstTranslations.GetCount() == m_stringFileInfo.GetStringTableCount());
CString strKey = m_stringFileInfo.GetFirstStringTable().GetKey();
POSITION posTranslation = lstTranslations.GetHeadPosition();
while (posTranslation)
{
CString strTranslation = lstTranslations.GetNext(posTranslation);
CString strTranslationUpper (strTranslation);
strTranslation.MakeUpper();
ASSERT(m_stringFileInfo.HasStringTable(strTranslation) || m_stringFileInfo.HasStringTable(strTranslationUpper));
}
//Verify Write
CVersionInfoBuffer viSaveBuf;
Write(viSaveBuf);
ASSERT(viSaveBuf.GetPosition() == viLoadBuf.GetPosition());
ASSERT(!memcmp(viSaveBuf.GetData(), viLoadBuf.GetData(), viSaveBuf.GetPosition()));
CFile fOriginal(_T("f1.res"), CFile::modeCreate | CFile::modeWrite);
fOriginal.Write(viLoadBuf.GetData(), viLoadBuf.GetPosition());
fOriginal.Close();
CFile fSaved(_T("f2.res"), CFile::modeCreate | CFile::modeWrite);
fSaved.Write(viSaveBuf.GetData(), viSaveBuf.GetPosition());
fSaved.Close();
#endif
return TRUE;
}
示例14: IJA_llQueryTableTransaction
BOOL IJA_llQueryTableTransaction (
CaQueryTransactionInfo* pQueryInfo,
CTypedPtrList<CObList, CaColumn*>* pListColumn,
CTypedPtrList < CObList, CaTableTransactionItemData* >& listTransaction)
{
CString strDatabase;
CString strDatabaseOwner;
CString strTable;
CString strTableOwner;
CString strStatement;
pQueryInfo->GetDatabase (strDatabase, strDatabaseOwner);
pQueryInfo->GetTable (strTable, strTableOwner);
//
// Open the session:
CaTemporarySession session (pQueryInfo->GetNode(), strDatabase);
if (!session.IsConnected())
{
//
// Failedto get Session.
CString strMsg;
strMsg.LoadString (IDS_FAIL_TO_GETSESSION);
AfxMessageBox (strMsg);
return FALSE;
}
CString strTempTable = _T("");
CString csGranteeList = _T(""); /* no grantee list required here */
BOOL bOK = IJA_TableAuditdbOutput (pQueryInfo, &session, strTempTable, pListColumn, csGranteeList);
if (!bOK) {
session.Release(SESSION_ROLLBACK);
return FALSE;
}
BOOL bOnLocal = session.IsLocalNode();
//
// STEP 1: Select row that are INSERT, DELETE, REPOLD, REPNEW
// Select the rows (table transactions) from the newly created Table:
CString strSessionPrefix = _T("");
if (bOnLocal)
strSessionPrefix = _T("session.");
strStatement.Format (
_T("select * from %s%s where operation in ('repold', 'repnew', 'append', 'insert', 'delete')"),
(LPCTSTR)strSessionPrefix,
(LPCTSTR)strTempTable);
CaIjaCursor cursor(1, strStatement);
if (cursor.Open())
{
int nCount = 0;
CStringList listData;
CString strItem1;
CString strItem2;
while (cursor.Fetch(listData, nCount))
{
CaTableTransactionItemData* pTran = new CaTableTransactionItemData();
POSITION pos = listData.GetHeadPosition();
ASSERT (listData.GetCount() >= 10); // At least 10 columns;
if (listData.GetCount() < 10)
{
delete pTran;
return FALSE;
}
pTran->SetTable (strTable);
pTran->SetTableOwner (strTableOwner);
if (pos != NULL)
{
// LSN:
strItem1 = listData.GetNext (pos);
strItem2 = listData.GetNext (pos);
pTran->SetLsn (_ttoul(strItem1), _ttoul(strItem2));
// TID:
strItem1 = listData.GetNext (pos);
pTran->SetTid(_ttol(strItem1));
// Date:
strItem1 = listData.GetNext (pos);
pTran->SetDate(strItem1);
// User Name:
strItem1 = listData.GetNext (pos);
pTran->SetUser (strItem1);
// Operation:
strItem1 = listData.GetNext (pos);
if (strItem1.CompareNoCase (_T("insert")) == 0 || strItem1.CompareNoCase (_T("append")) == 0)
pTran->SetOperation (T_INSERT);
else
if (strItem1.CompareNoCase (_T("delete")) == 0)
pTran->SetOperation (T_DELETE);
else
if (strItem1.CompareNoCase (_T("repold")) == 0)
pTran->SetOperation (T_BEFOREUPDATE);
else
if (strItem1.CompareNoCase (_T("repnew")) == 0)
pTran->SetOperation (T_AFTERUPDATE);
else
{
ASSERT (FALSE);
pTran->SetOperation (T_UNKNOWN);
//.........这里部分代码省略.........
示例15: OnInitDialog
BOOL CWizSoundSysPage::OnInitDialog()
{
CNGWizardPage::OnInitDialog();
TRANSLATE(*this, IDD);
//fill output
switch(m_nSoundSystem)
{
case SOUNDSYSTEM_WINMM :
m_WinButton.SetCheck(BST_CHECKED);
OnBnClickedRadioWinaudio();
break;
case SOUNDSYSTEM_DSOUND :
default :
m_DxButton.SetCheck(BST_CHECKED);
OnBnClickedRadioDirectsound();
break;
}
if(m_nOutputDevice == -1)
{
m_OutputDriversCombo.SetCurSel(0);
m_nOutputDevice = int(m_OutputDriversCombo.GetItemData(m_OutputDriversCombo.GetCurSel()));
}
if(m_nInputDevice == -1)
{
m_InputDriversCombo.SetCurSel(0);
m_nInputDevice = int(m_InputDriversCombo.GetItemData(m_InputDriversCombo.GetCurSel()));
}
OnCbnSelchangeComboOutputdriver();
OnCbnSelchangeComboInputdriver();
//find select mixer device
CStringList list;
int count = TT_Mixer_GetWaveInControlCount(0);
int nSelectedIndex = -1;
for(int i=0;i<count;i++)
{
TCHAR buff[TT_STRLEN] = {};
TT_Mixer_GetWaveInControlName(0, i, buff);
list.AddTail(buff);
if(TT_Mixer_GetWaveInControlSelected(0, i))
nSelectedIndex = i;
}
if(list.GetCount())
{
for(POSITION pos=list.GetHeadPosition(); pos!= NULL;)
m_wndMixerCombo.AddString(list.GetNext(pos));
m_wndMixerCombo.SetCurSel(nSelectedIndex);
}
else
{
m_wndMixerCombo.EnableWindow(FALSE);
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}