本文整理汇总了C++中CStringList::GetHeadPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ CStringList::GetHeadPosition方法的具体用法?C++ CStringList::GetHeadPosition怎么用?C++ CStringList::GetHeadPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CStringList
的用法示例。
在下文中一共展示了CStringList::GetHeadPosition方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetVersion
CString CFGFilterLAV::GetVersion(LAVFILTER_TYPE filterType /*= INVALID*/)
{
CStringList paths;
if (filterType == INVALID) {
paths.AddTail(GetFilterPath(SPLITTER));
paths.AddTail(GetFilterPath(VIDEO_DECODER));
paths.AddTail(GetFilterPath(AUDIO_DECODER));
} else {
paths.AddTail(GetFilterPath(filterType));
}
QWORD uiVersionMin = UINT64_MAX;
QWORD uiVersionMax = 0ui64;
CString strVersionMin, strVersionMax;
POSITION pos = paths.GetHeadPosition();
while (pos) {
CString& path = paths.GetNext(pos);
QWORD version = CFileVersionInfo::GetFileVersionNum(path);
if (version) {
if (version < uiVersionMin) {
uiVersionMin = version;
strVersionMin = CFileVersionInfo::GetFileVersionStr(path);
}
if (version > uiVersionMax) {
uiVersionMax = version;
strVersionMax = CFileVersionInfo::GetFileVersionStr(path);
}
}
}
CString version;
if (uiVersionMin != UINT64_MAX) {
version = strVersionMin;
if (uiVersionMax != uiVersionMin) {
version.AppendFormat(_T(" - %s"), strVersionMax);
}
}
return version;
}
示例2: GetValueFromList
CString GetValueFromList(const CString strName,CStringList& strList)
{
POSITION pos=NULL;
pos=strList.GetHeadPosition();
int nIndex=0;
CString strItem=_T("");
CString strValue=_T("");
while(pos!=NULL)
{
strItem=strList.GetNext(pos);
nIndex=strItem.Find("=");
strValue=strItem.Left(nIndex);
if (strValue==strName)
{
strValue=strItem.Right(strItem.GetLength()-nIndex-1);
return strValue;
}
}
return "";
}
示例3: FindUniqueSubstring
// String matching
static CString FindUniqueSubstring(const CStringList &list, const CString &value, bool initial = false, bool exact = false)
{
// Compare lower case strings for case insensitivity
CString substring = value;
substring.MakeLower();
CString match;
for (POSITION pos = list.GetHeadPosition(); pos;)
{
CString entry = list.GetNext(pos);
entry.MakeLower();
int found = entry.Find(substring);
if ((initial ? found == 0 : 0 <= found)
&& (!exact || (entry.GetLength() == substring.GetLength())))
{
if (!match.IsEmpty()) return _T("");
match = entry;
}
}
return match;
}
示例4: ParseScript
//Parse script into commands and parameters
void CScriptParser::ParseScript(CString &script)
{
//Strip off Windows return characters
script.Remove('\r');
//Separate script into separate lines in a list
CStringList commandLineList;
CScriptParser::StringSplit(commandLineList, script, CString('\n'));
//For each command line, split out keyword and parameters
POSITION pos;
for(pos = commandLineList.GetHeadPosition(); pos != NULL;)
{
CommandLine command;
CString line = commandLineList.GetNext(pos);
int firstSpacePos = line.Find(' ');
if(firstSpacePos != -1 && firstSpacePos != 0)
{
command.keyword = line.Left(firstSpacePos);
command.params = line.Right(line.GetLength() - firstSpacePos - 1);
}
else
{
command.keyword = line;
command.params.Empty();
}
m_CommandLines.AddTail(command);
}
// Debug
/*
for( pos = m_CommandLines.GetHeadPosition(); pos != NULL; )
{
CommandLine cmdLine = m_CommandLines.GetNext( pos );
CString str = CString("keyword: \"") + cmdLine.keyword + CString("\"");
str = str + CString("\nparams: \"") + cmdLine.params + CString("\"");
AfxMessageBox(str);
}
*/
}
示例5: FilterTreeIsSubDirectory
bool CSharedDirsTreeCtrl::FilterTreeIsSubDirectory(CString strDir, CString strRoot, CStringList& liDirs){
POSITION pos = liDirs.GetHeadPosition();
strRoot.MakeLower();
strDir.MakeLower();
if (strDir.Right(1) != _T("\\")){
strDir += _T("\\");
}
if (strRoot.Right(1) != _T("\\")){
strRoot += _T("\\");
}
while (pos){
CString strCurrent = thePrefs.shareddir_list.GetNext(pos);
strCurrent.MakeLower();
if (strCurrent.Right(1) != _T("\\")){
strCurrent += _T("\\");
}
if (strRoot.Find(strCurrent, 0) != 0 && strDir.Find(strCurrent, 0) == 0 && strCurrent != strRoot && strCurrent != strDir)
return true;
}
return false;
}
示例6: OnInitDialog
BOOL CWizWelcomePage::OnInitDialog()
{
CNGWizardPage::OnInitDialog();
VERIFY(font1.CreateFont(
24, // nHeight
0, // nWidth
0, // nEscapement
0, // nOrientation
FW_BOLD, // nWeight
FALSE, // bItalic
FALSE, // bUnderline
0, // cStrikeOut
ANSI_CHARSET, // nCharSet
OUT_DEFAULT_PRECIS, // nOutPrecision
CLIP_DEFAULT_PRECIS, // nClipPrecision
ANTIALIASED_QUALITY, // nQuality
DEFAULT_PITCH | FF_SWISS, // nPitchAndFamily
_T("Arial"))); // lpszFacename
m_wndTitle.SetFont(&font1);
CStringList languages;
GetLanguageFiles(languages);
for(POSITION pos=languages.GetHeadPosition();pos!=NULL;)
m_wndLanguage.AddString(languages.GetNext(pos));
if(!m_szLanguage.IsEmpty())
m_wndLanguage.SelectString(-1, m_szLanguage);
else
m_wndLanguage.SetCurSel(0);
m_wndLanguage.EnableWindow(m_bLanguage);
TRANSLATE(*this, IDD);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
示例7: OnInitDialog
BOOL CBCGPMenuPage::OnInitDialog()
{
{
CBCGPLocalResource locaRes;
CPropertyPage::OnInitDialog();
}
if (m_iMenuAnimationType == (int) CBCGPPopupMenu::SYSTEM_DEFAULT_ANIMATION)
{
m_iMenuAnimationType = m_wndMenuAnimations.GetCount () - 1;
UpdateData (FALSE);
}
POSITION pos = NULL;
//----------------------------------------------------------
// Find application Menu Bar object (assume that only one):
//---------------------------------------------------------
for (pos = gAllToolbars.GetHeadPosition ();
m_pMenuBar == NULL && pos != NULL;)
{
CBCGPToolBar* pToolBar = (CBCGPToolBar*) gAllToolbars.GetNext (pos);
ASSERT (pToolBar != NULL);
if (CWnd::FromHandlePermanent (pToolBar->m_hWnd) != NULL)
{
ASSERT_VALID(pToolBar);
m_pMenuBar = DYNAMIC_DOWNCAST (CBCGPMenuBar, pToolBar);
}
}
if (m_pMenuBar != NULL)
{
m_pMenuBar->m_pMenuPage = this;
int iCurrMenu = -1;
//---------------------------
// Save MenuBar current menu:
//---------------------------
m_hmenuCurr = m_pMenuBar->GetHMenu ();
m_pMenuBar->OnChangeHot (-1);
g_menuHash.SaveMenuBar (m_hmenuCurr, m_pMenuBar);
//-------------------------------------------------------------------
// Find all application document templates and fill menues combobox
// by document template data:
//------------------------------------------------------------------
CDocManager* pDocManager = AfxGetApp ()->m_pDocManager;
if (m_bAutoSet && pDocManager != NULL)
{
POSITION pos = NULL;
//---------------------------------------
// Walk all templates in the application:
//---------------------------------------
for (pos = pDocManager->GetFirstDocTemplatePosition (); pos != NULL;)
{
CBCGPMultiDocTemplate* pTemplate =
(CBCGPMultiDocTemplate*) pDocManager->GetNextDocTemplate (pos);
ASSERT_VALID (pTemplate);
ASSERT_KINDOF (CDocTemplate, pTemplate);
//-----------------------------------------------------
// We are interessing CMultiDocTemplate objects with
// the shared menu only....
//-----------------------------------------------------
if (!pTemplate->IsKindOf (RUNTIME_CLASS (CMultiDocTemplate)) ||
pTemplate->m_hMenuShared == NULL)
{
continue;
}
//----------------------------------------------------
// Maybe, the template with same ID is already exist?
//----------------------------------------------------
BOOL bIsAlreadyExist = FALSE;
for (int i = 0; !bIsAlreadyExist && i < m_wndMenuesList.GetCount (); i++)
{
CBCGPMultiDocTemplate* pListTemplate =
(CBCGPMultiDocTemplate*) m_wndMenuesList.GetItemData (i);
bIsAlreadyExist = pListTemplate != NULL &&
pListTemplate->GetResId () == pTemplate->GetResId ();
}
if (!bIsAlreadyExist)
{
CString strName;
pTemplate->GetDocString (strName, CDocTemplate::fileNewName);
int iIndex = m_wndMenuesList.AddString (strName);
m_wndMenuesList.SetItemData (iIndex, (DWORD_PTR) pTemplate);
if (pTemplate->m_hMenuShared == m_hmenuCurr)
{
iCurrMenu = iIndex;
}
}
}
//.........这里部分代码省略.........
示例8: 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;
}
示例9: DoDrag
void CMusikSourcesCtrl::DoDrag( CMusikPropTreeItem* pItem )
{
if ( !pItem )
return;
COleDataSource datasrc;
HGLOBAL hgDrop;
DROPFILES* pDrop;
CStringList lsDraggedFiles;
POSITION pos;
CString sFile;
UINT uBuffSize = 0;
TCHAR* pszBuff;
FORMATETC etc = { CF_HDROP, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
// get a list of filenames with the currently
// selected items...
CStdStringArray files;
int nMode = pItem->GetPlaylistType();
// standard playlist dragged
if ( nMode == MUSIK_PLAYLIST_TYPE_STANDARD )
m_Library->GetStdPlaylistFns( pItem->GetPlaylistID(), files, false );
// now playing dragged..
else if ( nMode == MUSIK_SOURCES_TYPE_NOWPLAYING )
{
if ( m_Player->GetPlaylist() )
{
m_Library->BeginTransaction();
for ( size_t i = 0; i < m_Player->GetPlaylist()->GetCount(); i++ )
files.push_back( m_Player->GetPlaylist()->GetField( i, MUSIK_LIBRARY_TYPE_FILENAME ) );
m_Library->EndTransaction();
}
}
// library playlist dragged
else if ( nMode == MUSIK_SOURCES_TYPE_LIBRARY )
{
CMainFrame* pMain = (CMainFrame*)m_Parent;
if ( pMain->m_LibPlaylist )
{
m_Library->BeginTransaction();
for ( size_t i = 0; i < pMain->m_LibPlaylist->GetCount(); i++ )
files.push_back( pMain->m_LibPlaylist->GetField( i, MUSIK_LIBRARY_TYPE_FILENAME ) );
m_Library->EndTransaction();
}
}
else if ( nMode == MUSIK_PLAYLIST_TYPE_DYNAMIC )
MessageBox( "This operation is not supported yet.", "Musik", MB_ICONINFORMATION | MB_OK );
if ( !files.size() )
return;
// CStringList containing files
for ( size_t i = 0; i < files.size(); i++ )
{
lsDraggedFiles.AddTail( files.at( i ) );
uBuffSize += files.at( i ).GetLength() + 1;
}
files.clear();
// Add 1 extra for the final null char, and the size of the DROPFILES struct.
uBuffSize = sizeof(DROPFILES) + sizeof(TCHAR) * (uBuffSize + 1);
// Allocate memory from the heap for the DROPFILES struct.
hgDrop = GlobalAlloc ( GHND | GMEM_SHARE, uBuffSize );
if ( !hgDrop )
return;
pDrop = (DROPFILES*) GlobalLock ( hgDrop );
if ( !pDrop )
{
GlobalFree ( hgDrop );
return;
}
// Fill in the DROPFILES struct.
pDrop->pFiles = sizeof(DROPFILES);
// If we're compiling for Unicode, set the Unicode flag in the struct to
// indicate it contains Unicode strings.
#ifdef _UNICODE
pDrop->fWide = TRUE;
#endif;
// Copy all the filenames into memory after the end of the DROPFILES struct.
pos = lsDraggedFiles.GetHeadPosition();
pszBuff = (TCHAR*) (LPBYTE(pDrop) + sizeof(DROPFILES));
while ( pos )
{
lstrcpy ( pszBuff, (LPCTSTR) lsDraggedFiles.GetNext ( pos ) );
pszBuff = 1 + _tcschr ( pszBuff, '\0' );
//.........这里部分代码省略.........
示例10: OnLoad
LONG CuDlgReplicationStaticPageActivity::OnLoad (WPARAM wParam, LPARAM lParam)
{
LPCTSTR pClass = (LPCTSTR)wParam;
ASSERT (lstrcmp (pClass, _T("CaReplicationStaticDataPageActivity")) == 0);
CaReplicationStaticDataPageActivity* pData = (CaReplicationStaticDataPageActivity*)lParam;
if (!pData)
return 0L;
POSITION p, pos = NULL;
CStringList* pObj = NULL;
try
{
m_strInputQueue = pData->m_strInputQueue;
m_strDistributionQueue = pData->m_strDistributionQueue;
m_strStartingTime = pData->m_strStartingTime;
UpdateData (FALSE);
//
// Summary:
//
// For each column:
const int LAYOUT_NUMBER = 6;
for (int i=0; i<LAYOUT_NUMBER; i++)
m_cListCtrl.SetColumnWidth(i, pData->m_cxSummary.GetAt(i));
int nCount = 0;
pos = pData->m_listSummary.GetHeadPosition();
while (pos != NULL)
{
pObj = pData->m_listSummary.GetNext (pos);
ASSERT (pObj);
ASSERT (pObj->GetCount() == 6);
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.SetItemText (nCount, 5, (LPCTSTR)pObj->GetNext(p));
}
m_cListCtrl.SetScrollPos (SB_HORZ, pData->m_scrollSummary.cx);
m_cListCtrl.SetScrollPos (SB_VERT, pData->m_scrollSummary.cy);
CuListCtrl* pList = NULL;
//
// Per database (Outgoing):
m_pDatabaseOutgoing->SetAllColumnWidth (pData->m_cxDatabaseOutgoing);
pList = &(m_pDatabaseOutgoing->m_cListCtrl);
pos = pData->m_listDatabaseOutgoing.GetHeadPosition();
while (pos != NULL)
{
pObj = pData->m_listDatabaseOutgoing.GetNext (pos);
ASSERT (pObj);
ASSERT (pObj->GetCount() == 6);
nCount = pList->GetItemCount();
p = pObj->GetHeadPosition();
pList->InsertItem (nCount, (LPCTSTR)pObj->GetNext(p));
pList->SetItemText (nCount, 1, (LPCTSTR)pObj->GetNext(p));
pList->SetItemText (nCount, 2, (LPCTSTR)pObj->GetNext(p));
pList->SetItemText (nCount, 3, (LPCTSTR)pObj->GetNext(p));
pList->SetItemText (nCount, 4, (LPCTSTR)pObj->GetNext(p));
pList->SetItemText (nCount, 5, (LPCTSTR)pObj->GetNext(p));
}
m_pDatabaseOutgoing->SetScrollPosListCtrl (pData->m_scrollDatabaseOutgoing);
//
// Per database (Incoming):
m_pDatabaseIncoming->SetAllColumnWidth (pData->m_cxDatabaseIncoming);
pList = &(m_pDatabaseIncoming->m_cListCtrl);
pos = pData->m_listDatabaseIncoming.GetHeadPosition();
while (pos != NULL)
{
pObj = pData->m_listDatabaseIncoming.GetNext (pos);
ASSERT (pObj);
ASSERT (pObj->GetCount() == 6);
nCount = pList->GetItemCount();
p = pObj->GetHeadPosition();
pList->InsertItem (nCount, (LPCTSTR)pObj->GetNext(p));
pList->SetItemText (nCount, 1, (LPCTSTR)pObj->GetNext(p));
pList->SetItemText (nCount, 2, (LPCTSTR)pObj->GetNext(p));
pList->SetItemText (nCount, 3, (LPCTSTR)pObj->GetNext(p));
pList->SetItemText (nCount, 4, (LPCTSTR)pObj->GetNext(p));
pList->SetItemText (nCount, 5, (LPCTSTR)pObj->GetNext(p));
}
m_pDatabaseIncoming->SetScrollPosListCtrl (pData->m_scrollDatabaseIncoming);
//
// Per database (Total):
m_pDatabaseTotal->SetAllColumnWidth (pData->m_cxDatabaseTotal);
pList = &(m_pDatabaseTotal->m_cListCtrl);
pos = pData->m_listDatabaseTotal.GetHeadPosition();
while (pos != NULL)
{
pObj = pData->m_listDatabaseTotal.GetNext (pos);
ASSERT (pObj);
ASSERT (pObj->GetCount() == 6);
nCount = pList->GetItemCount();
p = pObj->GetHeadPosition();
pList->InsertItem (nCount, (LPCTSTR)pObj->GetNext(p));
pList->SetItemText (nCount, 1, (LPCTSTR)pObj->GetNext(p));
pList->SetItemText (nCount, 2, (LPCTSTR)pObj->GetNext(p));
pList->SetItemText (nCount, 3, (LPCTSTR)pObj->GetNext(p));
pList->SetItemText (nCount, 4, (LPCTSTR)pObj->GetNext(p));
//.........这里部分代码省略.........
示例11: 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
}
示例12: OnExecute
////////////////////////////////////////////
// OnExecute
// Demonstrate:
// IDirectorySearch::ExecuteSearch
// IDirectorySearch::GetNextRow
// IDirectorySearch::GetColumn
// IDirectorySearch::SetSearchPreference
//
/////////////////////////////////////////////
void CDlgIDirectorySearch::OnExecute()
{
ASSERT( m_pSearch );
CWaitCursor wait;
UpdateData(TRUE); // Get data from the Dialog Box
HRESULT hr;
ADS_SEARCH_HANDLE hSearch;
ADS_SEARCH_COLUMN col;
CString s;
int idx=0;
int nCount;
LPWSTR *pszAttr=NULL;
POSITION pos;
USES_CONVERSION;
/////////////////////////////////
// Reset the Total Number
//////////////////////////////////
SetDlgItemText( IDC_TOTAL, _T(""));
/////////////////////////////////////////////
// Get the attribute list, and preparing..
///////////////////////////////////////////
CStringList sAttrList;
m_cListView.DeleteAllItems(); // Reset the UI
while( m_cListView.DeleteColumn(0))
{
;
}
//////////////////////////////////////////////////
// Preparing for attribute list
// and columns to display
CString sTemp;
m_cAttrList.GetWindowText(s);
// we need to add adspath, so that we can refer to this object later when user dblclk the item
if ( !s.IsEmpty() )
{
sTemp = s;
sTemp.MakeLower();
if ( s.Find(_T("adspath"),0) == -1 )
{
s += _T(",ADsPath");
}
}
// convert to string list for easy manipulation
StringToStringList( s, sAttrList );
nCount = sAttrList.GetCount();
idx=0;
if ( nCount )
{
pszAttr = (LPWSTR*) AllocADsMem( nCount * sizeof(LPWSTR));
pos = sAttrList.GetHeadPosition();
while ( pos != NULL )
{
s = sAttrList.GetAt(pos);
pszAttr[idx] = T2OLE(s);
sAttrList.GetNext(pos );
idx++;
}
}
else
{
nCount = -1;
}
/////////////////////////////////////////
// BEGIN Set the preferences
///////////////////////////////////////
DWORD dwCountPref = 0;
ADS_SEARCHPREF_INFO prefInfo[ MAX_SEARCH_PREF ];
ADS_SORTKEY *pSortKey = NULL;
//.........这里部分代码省略.........
示例13: bPopulateTree
BOOL CMsgSgTreeView::bPopulateTree()
{
// Insert the database filename as the root item
// CMainFrame* pMainFrm = (CMainFrame*)AfxGetApp()->m_pMainWnd;
BOOL bReturnValue = TRUE;
CMsgSignal* pTempMsgSg = NULL;
pTempMsgSg = *((CMsgSignal**)m_sDbParams.m_ppvActiveDB);
// Get reference to the tree control
CTreeCtrl& om_tree = GetTreeCtrl();
//
om_tree.DeleteAllItems();
om_tree.SetTextColor( BLUE_COLOR );
CString omStrDatabaseFilename = m_omCurrDbName;
if ( omStrDatabaseFilename.IsEmpty() )
{
bReturnValue = FALSE;
AfxMessageBox(MSG_DB_NOT_FOUND, MB_OK);
}
else
{
// om_tree.DeleteAllItems();
// Insert database filename
HTREEITEM hRootItem = om_tree.InsertItem( omStrDatabaseFilename );
om_tree.SetItemImage(hRootItem, 0, 0);
CStringList omMessageNames;
// Clean the list
omMessageNames.RemoveAll();
// Get all the database message names
pTempMsgSg->omStrListGetMessageNamesInactive(omMessageNames);
POSITION pos = omMessageNames.GetHeadPosition();
BOOL bSelFirstChild = FALSE;
// Insert all message names
while ( pos != NULL )
{
CString omStrMsgName = omMessageNames.GetNext(pos);
HTREEITEM hMsg = om_tree.InsertItem( omStrMsgName, hRootItem );
if(bSelFirstChild != TRUE )
{
om_tree.SelectItem( hMsg );
bSelFirstChild = TRUE;
}
om_tree.SetItemImage(hMsg, 1, 1);
}
// Expand the root
om_tree.Expand( hRootItem, TVE_EXPAND );
if(bSelFirstChild != TRUE )
{
// Select the root item
om_tree.SelectItem( hRootItem );
}
}
return (bReturnValue);
}
示例14: WebLogic
BOOL WebLogic(const char * strParas, char * szReturn, int& nSize)
//(CStringList ¶mList, char *szReturn)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
//参数解析:
CString
strServIp = _T(""),
strServPort = _T(""),
strUserName = _T(""),
strUserPwd = _T(""),
strTaskType = _T(""),
strTaskParam = _T("");
CString
strProxyServ = _T(""),
strProxyUser = _T("");
int nServerPort = 21;
int nTimeout = 60;
BOOL bRet = FALSE;
// Check Content Change
CStringList paramList;
MakeStringListByChar(paramList,strParas);
POSITION pos = paramList.GetHeadPosition();
while(pos)
{
CString strTemp = paramList.GetNext(pos);
if(strTemp.Find(__USERNAME__, 0) == 0)
{
strUserName = strTemp.Right(strTemp.GetLength() - strlen(__USERNAME__));
}
else if(strTemp.Find(__PASSWORD__, 0) == 0)
{
strUserPwd = strTemp.Right(strTemp.GetLength() - strlen(__PASSWORD__));
}
else if(strTemp.Find(__TIMEOUT__, 0) == 0)
{
nTimeout = atoi(strTemp.Right(strTemp.GetLength() - strlen(__TIMEOUT__)));
}
else if(strTemp.Find(__SERVERIP__, 0) == 0)
{
strServIp = strTemp.Right(strTemp.GetLength() - strlen(__SERVERIP__));
}
else if(strTemp.Find(__SERVERPORT__, 0) == 0)
{
strServPort = strTemp.Right(strTemp.GetLength() - strlen(__SERVERPORT__));
}
else if(strTemp.Find(__TASKTYPE__, 0) == 0)
{
strTaskType = strTemp.Right(strTemp.GetLength() - strlen(__TASKTYPE__));
}
else if(strTemp.Find(__TASKPARAM__, 0) == 0)
{
strTaskParam = strTemp.Right(strTemp.GetLength() - strlen(__TASKPARAM__));
}
else
{
}
}
if(strUserName.IsEmpty())
{
sprintf(szReturn, "error=%s", FuncGetStringFromIDS("IDS_Poor_UserName"));//"缺少用户姓名!");//<%IDS_Monitor_40%>"缺少FTP服务器地址"
return FALSE;
}
if(strUserPwd.IsEmpty())
{
sprintf(szReturn, "error=%s", FuncGetStringFromIDS("IDS_Poor_Password"));//"缺少用户密码!");//<%IDS_Monitor_40%>
return FALSE;
}
if(strServIp.IsEmpty())
{
sprintf(szReturn, "error=%s", FuncGetStringFromIDS("IDS_Poor_ServerAddress"));//"缺少服务器地址!");//<%IDS_Monitor_40%>"缺少FTP服务器地址"
return FALSE;
}
if(strServPort.IsEmpty())
{
sprintf(szReturn, "error=%s", FuncGetStringFromIDS("IDS_Poor_ServerPort"));//"缺少服务器端口地址!");//<%IDS_Monitor_40%>"缺少FTP服务器地址"
return FALSE;
}
if(strTaskType.IsEmpty())
{
sprintf(szReturn, "error=%s", FuncGetStringFromIDS("IDS_Poor_TaskType"));//"缺少任务类型!");//<%IDS_Monitor_40%>"缺少FTP服务器地址"
return FALSE;
}
if(strTaskParam.IsEmpty())
{
strTaskParam = "null";
}
//.........这里部分代码省略.........
示例15: OnInitDialog
BOOL ModifyIDThree::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
m_Year.EnableWindow(FALSE);
m_Track.EnableWindow(FALSE);
m_Title.EnableWindow(FALSE);
m_Genre.EnableWindow(FALSE);
m_Artist.EnableWindow(FALSE);
m_Album.EnableWindow(FALSE);
// CString genre = id3_GetGenre(mID3_Tag);
CString oldgenre = m_Song->getId3(CS("TCON"));
oldgenre = Genre_normalize((LPCTSTR)oldgenre);
CString oldartist = m_Song->getId3(CS("TPE1"));
CString oldalbum = m_Song->getId3(CS("TALB"));
CString oldtitle = m_Song->getId3(CS("TIT2"));
CString oldtrack = m_Song->getId3(CS("TRCK"));
CString oldyear = m_Song->getId3(CS("TYER"));
CString file = m_Song->getId3("FILE");
m_File.SetWindowText(file);
CString newgenre, newartist, newalbum, newtitle, newtrack, newyear;
newgenre = oldgenre;
newartist = oldartist;
newalbum = oldalbum;
newtitle = oldtitle;
newtrack = oldtrack;
newyear = oldyear;
// oldgenre = "\"" + oldgenre + "\"";
// oldartist = "\"" + oldartist + "\"";
// oldalbum = "\"" + oldalbum + "\"";
// oldtitle = "\"" + oldtitle + "\"";
// oldtrack = "\"" + oldtrack + "\"";
// oldyear = "\"" + oldyear + "\"";
if (MBALL == newartist) {
newartist = "";
}
if (MBALL == newalbum) {
newalbum = "";
}
if (MBALL == newgenre) {
newgenre = "";
}
m_OldGenre.SetWindowText(oldgenre);
int pos;
CString tmpGenre;
for (pos = 0 ; pos < mGenreList->GetSize(); pos++) {
tmpGenre = mGenreList->GetAt(pos);
m_Genre.AddString(tmpGenre);
}
m_Genre.SelectString(0, newgenre );
int x = m_Genre.GetCount();
if (mWindowFlag >= 1 /*&& genre != MBALL */) {
m_Genre.EnableWindow(TRUE);
}
if (mWindowFlag >= 2) {
m_Artist.EnableWindow(TRUE);
m_Artist.SetWindowText(newartist);
m_OldArtist.SetWindowText(oldartist);
// if (artist == MBALL)
// m_Artist.EnableWindow(FALSE);
}
if (mWindowFlag >= 3) {
m_Album.EnableWindow(TRUE);
m_Year.EnableWindow(TRUE);
m_Album.SetWindowText(newalbum);
m_OldAlbum.SetWindowText(oldalbum);
m_Year.SetWindowText(newyear);
m_OldYear.SetWindowText(oldyear);
// if (album == MBALL) {
// m_Album.EnableWindow(FALSE);
// }
}
m_TagData.ShowWindow(FALSE);
m_File.ShowWindow(FALSE);
if (mWindowFlag >= 4) {
m_Title.EnableWindow(TRUE);
m_Track.EnableWindow(TRUE);
m_Title.SetWindowText(newtitle);
m_OldTitle.SetWindowText(oldtitle);
m_Track.SetWindowText(newtrack);
m_OldTrack.SetWindowText(oldtrack);
m_TagData.ShowWindow(TRUE);
m_File.ShowWindow(TRUE);
MBTag tag;
CStringList list;
tag.getInfo(file,list);
for(POSITION pos = list.GetHeadPosition();pos!=NULL;list.GetNext(pos)) {
m_TagData.AddString(list.GetAt(pos));
}
m_OldValsLabel.SetWindowText("Old value");
//.........这里部分代码省略.........