本文整理汇总了C++中CStringList::GetAt方法的典型用法代码示例。如果您正苦于以下问题:C++ CStringList::GetAt方法的具体用法?C++ CStringList::GetAt怎么用?C++ CStringList::GetAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CStringList
的用法示例。
在下文中一共展示了CStringList::GetAt方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnLvnItemchangedList
void CDlgWingspanAdjacancyConstraints::OnLvnItemchangedList(NMHDR *pNMHDR, LRESULT *pResult)
{
LPNMLISTVIEW pNMLV = reinterpret_cast<LPNMLISTVIEW>(pNMHDR);
UpdateToolBarState();
int nSelItem = GetSelectedListItem();
if (nSelItem < 0)
return;
CWingspanAdjacencyConstraints *pConstraint = (CWingspanAdjacencyConstraints *)m_wndListCtrl.GetItemData(nSelItem);
if (pConstraint == NULL)
return;
{
CStringList lstFirstNode;
GetNodeListByTaxiway(pConstraint->m_firstaxiway.m_pTaxiway,lstFirstNode);
LVCOLDROPLIST* pDroplistFrom = m_wndListCtrl.GetColumnStyle(1);
LVCOLDROPLIST* pDroplistTo = m_wndListCtrl.GetColumnStyle(2);
if(pDroplistFrom && pDroplistTo)
{
pDroplistFrom->List.RemoveAll();
pDroplistTo->List.RemoveAll();
POSITION pos;
for( pos = lstFirstNode.GetHeadPosition(); pos;)
{
pDroplistFrom->List.AddTail(lstFirstNode.GetAt(pos));
pDroplistTo->List.AddTail(lstFirstNode.GetAt(pos));
lstFirstNode.GetNext( pos );
}
}
}
{
CStringList lstSecondNode;
GetNodeListByTaxiway(pConstraint->m_secondTaxiway.m_pTaxiway,lstSecondNode);
LVCOLDROPLIST* pDroplistFrom = m_wndListCtrl.GetColumnStyle(7);
LVCOLDROPLIST* pDroplistTo = m_wndListCtrl.GetColumnStyle(8);
if(pDroplistFrom && pDroplistTo)
{
pDroplistFrom->List.RemoveAll();
pDroplistTo->List.RemoveAll();
POSITION pos;
for( pos = lstSecondNode.GetHeadPosition(); pos;)
{
pDroplistFrom->List.AddTail(lstSecondNode.GetAt(pos));
pDroplistTo->List.AddTail(lstSecondNode.GetAt(pos));
lstSecondNode.GetNext( pos );
}
}
}
}
示例2: 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
}
示例3: WriteFile
BOOL RegistryKey::WriteFile()
{
if (mFileName == "") return FALSE;
POSITION pos;
CString key;
CString val;
CString data;
AutoBuf buf(1000);
CStringList slist;
for( pos = mKeyValPairs->GetStartPosition(); pos != NULL; ) {
mKeyValPairs->GetNextAssoc(pos, key, val);
String::insertSort(slist, key);
}
for (pos = slist.GetHeadPosition(); pos != NULL; ) {
CString key = slist.GetAt(pos);
if (mKeyValPairs->Lookup(key, val)) {
if (key.GetLength() && val.GetLength()) {
sprintf(buf.p, "%s: %s\r\n", key, val);
data += buf.p;
}
}
slist.GetNext(pos);
}
// for( pos = mKeyValPairs->GetStartPosition(); pos != NULL; ) {
// mKeyValPairs->GetNextAssoc(pos, key, val);
// if (key.GetLength() && val.GetLength()) {
// sprintf(buf.p, "%s: %s\r\n", key, val);
// data += buf.p;
// }
// }
if (data == "") return FALSE;
CFile cfile;
CFileException e;
if (cfile.Open(mFileName,
CFile::modeCreate
// |CFile::modeNoTruncate
|CFile::modeWrite
// |CFile::typeText
|CFile::shareDenyNone,
&e) == FALSE) {
return FALSE;
}
cfile.Write(data, data.GetLength());
cfile.Flush();
cfile.Close();
return TRUE;
}
示例4: findGoodSkin
BOOL CConfigDisplay::findGoodSkin() {
CStringList list;
CString skin ;
readSkins(list);
POSITION pos ;
if (String::CStringListContains(list,"MBClassic")) {
skin = "MBClassic";
} else {
pos = list.GetHeadPosition();
if (!pos)
return FALSE;
skin = list.GetAt(pos);
}
return OnSkinChoose(skin);
}
示例5: 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);
}
示例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: CreateFile
void CWordFilter::Init()
{
HANDLE hFile;
DWORD dwRead;
int nLen;
BOOL bResult;
CStringList list;
//m_count = 0;
// 如果文件目录不对,程序移动一下,到config目录下 added by kernel1983 2006.07.31
if (PathFileExists(thePrefs.GetMuleDirectory(EMULE_EXECUTEABLEDIR) + FLITER_FILE))
MoveFile(thePrefs.GetMuleDirectory(EMULE_EXECUTEABLEDIR) + FLITER_FILE, thePrefs.GetMuleDirectory(EMULE_CONFIGDIR) + FLITER_FILE);
if (!PathFileExists(thePrefs.GetMuleDirectory(EMULE_CONFIGDIR) + FLITER_FILE))
{
// 不存在,所有的都过滤 added by kernel1983 2006.08.08
m_filterall = true;
return;
}
// Open file for read
hFile = CreateFile(thePrefs.GetMuleDirectory(EMULE_CONFIGDIR) + FLITER_FILE, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
//AddLogLine(false,_T(":%s\n"),thePrefs.GetMuleDirectory(EMULE_CONFIGDIR) + FLITER_FILE);
if(hFile == NULL || hFile == INVALID_HANDLE_VALUE)
{
// 读取错误,所有的都过滤 added by kernel1983 2006.08.08
m_filterall = true;
return;
}
DWORD dwSize = GetFileSize(hFile, NULL);
TCHAR * pszData = new TCHAR[(dwSize / sizeof(TCHAR)) + 1]; // 申请空间
bResult = ReadFile(hFile, pszData, dwSize, &dwRead, NULL); // 读入文件1
CloseHandle(hFile);
pszData[(dwSize / sizeof(TCHAR))] = 0;
if(bResult)
{
TCHAR * pszTemp = wcstok(pszData + 1, _T("\r\n"));
while(pszTemp != NULL)
{
nLen = wcslen(pszTemp);
while(pszTemp[nLen - 1] == '\t' || pszTemp[nLen - 1] == ' ')
{
nLen --;
pszTemp[nLen] = 0;
}
while(*pszTemp == '\t' || *pszTemp == ' ')
{
pszTemp ++;
nLen --;
}
//AddLogLine(false,_T("pszTemp:%s"),pszTemp);
//AddLogLine(false,_T("nLen:%d"),nLen);
if(nLen > 0)list.AddTail(pszTemp);
//if(nLen == 8)AddLogLine(false,_T(":%d %d %d %d "),((char*)pszTemp)[0],((char*)pszTemp)[1],((char*)pszTemp)[2],((char*)pszTemp)[3]);
pszTemp = wcstok(NULL, _T("\r\n"));
}
}
delete[] pszData;
m_count = list.GetCount();
//AddLogLine(false,_T("m_count:%d"),m_count);
if(bResult && m_count > 0)
{
m_filterwords = new TCHAR*[m_count+1];
m_kmpvalue = new int*[m_count+1];
ZeroMemory(m_filterwords, sizeof(TCHAR *) * m_count);
ZeroMemory(m_kmpvalue, sizeof(int *) * m_count);
}
for(int i = 0; bResult && (i < m_count); i ++)
{
CString s = list.GetAt(list.FindIndex(i));
s.MakeLower();
nLen = s.GetLength();
//AddLogLine(false,_T("nLen:%d"),nLen);
m_filterwords[i] = new TCHAR[nLen + 1];
m_filterwords[i][nLen] = 0; // 最后一个字节设为0
m_kmpvalue[i] = new int[nLen];
//AddLogLine(false,_T("nLen:%d"),nLen);
_tcscpy(m_filterwords[i],s);
//AddLogLine(false,_T("m_filterwords[i]:%s"),m_filterwords[i]);
KMP_GetNext(m_filterwords[i], m_kmpvalue[i]); // 得到一个与内容有关的数值m_kmpvalue[i]
}
if(m_count == 0 || !bResult)
{
Free();
//m_filterall = true;
}
}
示例8: InitPage
//***************************************************************************************
BOOL CBCGPToolBoxPage::InitPage (UINT uiBmpResID, int nImageWidth,
const CStringList& lstLabels,
CRuntimeClass* pButtonClass)
{
ASSERT_VALID (this);
m_pButtonClass = pButtonClass;
m_uiBmpResID = uiBmpResID;
if (!m_Images.Load (uiBmpResID))
{
ASSERT (FALSE);
return FALSE;
}
// Enable tooltips:
CBCGPTooltipManager::CreateToolTip (m_pToolTip, this,
BCGP_TOOLTIP_TYPE_TOOLBOX);
HBITMAP hBitmap = m_Images.GetImageWell ();
BITMAP bmp;
::GetObject (hBitmap, sizeof (BITMAP), (LPVOID) &bmp);
m_sizeImage.cx = nImageWidth;
m_sizeImage.cy = bmp.bmHeight;
m_Images.SetImageSize (m_sizeImage, TRUE);
if (globalData.GetRibbonImageScale () != 1.)
{
double dblImageScale = globalData.GetRibbonImageScale ();
m_sizeImage = CSize ((int)(.5 + m_sizeImage.cx * dblImageScale), (int)(.5 + m_sizeImage.cy * dblImageScale));
}
for (int i = 0; i < m_Images.GetCount (); i++)
{
CBCGPToolBoxButton* pButton = DYNAMIC_DOWNCAST (CBCGPToolBoxButton, pButtonClass->CreateObject ());
if (pButton == NULL)
{
ASSERT (FALSE);
return FALSE;
}
ASSERT_VALID (pButton);
pButton->SetParentPage (this);
pButton->SetImageList (&m_Images);
pButton->SetImageIndex (i);
pButton->SetID (i + 1);
POSITION posLabel = lstLabels.FindIndex (i);
if (posLabel != NULL)
{
pButton->SetLabel (lstLabels.GetAt (posLabel));
}
if (i == 0 && m_bCheckFirstButton)
{
m_nCheckedButton = 0;
pButton->SetCheck (TRUE);
RedrawButton (m_nCheckedButton);
}
m_arButtons.Add (pButton);
if (m_pToolTip->GetSafeHwnd () != NULL)
{
CRect rectDummy;
rectDummy.SetRectEmpty ();
m_pToolTip->AddTool ( this, LPSTR_TEXTCALLBACK, &rectDummy,
pButton->GetID ());
}
}
return TRUE;
}
示例9: 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;
//.........这里部分代码省略.........
示例10: verifySkin
BOOL CConfigDisplay::verifySkin(CString skin, BOOL stopOnError) {
#ifdef _DEBUGBC
return TRUE;
#endif
//AutoLog alog("CCD::verifySkin");
CStringList bmps;
bmps.AddTail(MB_SKIN_DEF);
bmps.AddTail(MB_SKIN_ALBUMART);
bmps.AddTail(MB_SKIN_BACKGROUNDMAIN);
bmps.AddTail(MB_SKIN_BACKGROUNDALBUMART);
bmps.AddTail(MB_SKIN_BACKGROUNDLIBRARY);
bmps.AddTail(MB_SKIN_BACKGROUNDMAIN);
bmps.AddTail(MB_SKIN_BACKGROUNDPLAYLIST);
bmps.AddTail(MB_SKIN_BUTTONLOGOOUT);
bmps.AddTail(MB_SKIN_BUTTONLOGOHOVER);
bmps.AddTail(MB_SKIN_BUTTONLOGOIN);
bmps.AddTail(MB_SKIN_BUTTONBACKGROUND);
bmps.AddTail(MB_SKIN_BUTTONCLEARHOVER);
bmps.AddTail(MB_SKIN_BUTTONCLEARIN);
bmps.AddTail(MB_SKIN_BUTTONCLEAROUT);
bmps.AddTail(MB_SKIN_BUTTONEXITHOVER);
bmps.AddTail(MB_SKIN_BUTTONEXITIN);
bmps.AddTail(MB_SKIN_BUTTONEXITOUT);
bmps.AddTail(MB_SKIN_BUTTONFASTFORWARDHOVER);
bmps.AddTail(MB_SKIN_BUTTONFASTFORWARDIN);
bmps.AddTail(MB_SKIN_BUTTONFASTFORWARDOUT);
bmps.AddTail(MB_SKIN_BUTTONLOADHOVER);
bmps.AddTail(MB_SKIN_BUTTONLOADIN);
bmps.AddTail(MB_SKIN_BUTTONLOADOUT);
bmps.AddTail(MB_SKIN_BUTTONMAXIMIZEHOVER);
bmps.AddTail(MB_SKIN_BUTTONMAXIMIZEIN);
bmps.AddTail(MB_SKIN_BUTTONMAXIMIZEOUT);
bmps.AddTail(MB_SKIN_BUTTONMINIMIZEHOVER);
bmps.AddTail(MB_SKIN_BUTTONMINIMIZEIN);
bmps.AddTail(MB_SKIN_BUTTONMINIMIZEOUT);
bmps.AddTail(MB_SKIN_BUTTONMENUHOVER);
bmps.AddTail(MB_SKIN_BUTTONMENUIN);
bmps.AddTail(MB_SKIN_BUTTONMENUOUT);
bmps.AddTail(MB_SKIN_BUTTONPAUSEOUT);
bmps.AddTail(MB_SKIN_BUTTONPLAYHOVER);
bmps.AddTail(MB_SKIN_BUTTONPLAYIN);
bmps.AddTail(MB_SKIN_BUTTONPLAYOUT);
bmps.AddTail(MB_SKIN_BUTTONPROGRESSBACKGROUND);
bmps.AddTail(MB_SKIN_BUTTONPROGRESSKNOB);
bmps.AddTail(MB_SKIN_BUTTONRANDOMHOVER);
bmps.AddTail(MB_SKIN_BUTTONRANDOMIN);
bmps.AddTail(MB_SKIN_BUTTONRANDOMOUT);
bmps.AddTail(MB_SKIN_BUTTONRESIZEHOVER);
bmps.AddTail(MB_SKIN_BUTTONRESIZEIN);
bmps.AddTail(MB_SKIN_BUTTONRESIZEOUT);
bmps.AddTail(MB_SKIN_BUTTONRESTOREHOVER);
bmps.AddTail(MB_SKIN_BUTTONRESTOREIN);
bmps.AddTail(MB_SKIN_BUTTONRESTOREOUT);
bmps.AddTail(MB_SKIN_BUTTONREVERSEHOVER);
bmps.AddTail(MB_SKIN_BUTTONREVERSEIN);
bmps.AddTail(MB_SKIN_BUTTONREVERSEOUT);
bmps.AddTail(MB_SKIN_BUTTONSAVEHOVER);
bmps.AddTail(MB_SKIN_BUTTONSAVEIN);
bmps.AddTail(MB_SKIN_BUTTONSAVEOUT);
bmps.AddTail(MB_SKIN_BUTTONSHUFFLEHOVER);
bmps.AddTail(MB_SKIN_BUTTONSHUFFLEIN);
bmps.AddTail(MB_SKIN_BUTTONSHUFFLEOUT);
bmps.AddTail(MB_SKIN_BUTTONSTOPHOVER);
bmps.AddTail(MB_SKIN_BUTTONSTOPIN);
bmps.AddTail(MB_SKIN_BUTTONSTOPOUT);
bmps.AddTail(MB_SKIN_BUTTONVOLUMEBACKGROUND);
bmps.AddTail(MB_SKIN_BUTTONVOLUMEKNOB);
bmps.AddTail(MB_SKIN_SCROLLBACKGROUND);
bmps.AddTail(MB_SKIN_SCROLLBUTTON);
bmps.AddTail(MB_SKIN_SCROLLDOWNARROW);
bmps.AddTail(MB_SKIN_SCROLLUPARROW);
POSITION pos;
CString name,msg,bmp;
for(pos = bmps.GetHeadPosition(); pos != NULL; ) {
name = bmps.GetAt(pos);
bmp = getSkin(skin, name);
if (bmp == "") {
if (msg.GetLength())
msg += "\r\n";
msg += name;
}
bmps.GetNext(pos);
}
CString tmp ;
if (msg != "") {
tmp = "The following bitmaps are missing from the\r\n";
tmp += skin;
tmp += " skin.\r\n";
tmp += msg + "\r\n";
msg = tmp;
}
// Verify SkinDef's
m_SkinDefKeyVals.RemoveAll();
loadSkinDefs();
CString skindef = getSkin(skin, MB_SKIN_DEF);
RegistryKey regSD(skindef);
regSD.ReadFile();
//.........这里部分代码省略.........
示例11: 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");
//.........这里部分代码省略.........
示例12: StartDropList
/***************************************************
StartDropList
This internal function is used to parse out
the label string, which contains the items to
show in the list. Also this function will
show the list box in the proper location on the
screen.
Params:
<none>
Return:
UG_ERROR - the list is already visible.
UG_SUCCESS - everything went smoothly, the drop
list was shown
***************************************************/
int CUGDropListType::StartDropList()
{
RECT rect;
RECT clientRect;
int dif,len,pos,startpos;
CFont * font = NULL;
LOGFONT lf;
CFont * cfont;
CStringList list; //lists of strings for the list are assembed here
CString * items; //points to the string used to assemble the list
//return false if it is already up
if( m_listBox->m_HasFocus)
return UG_ERROR;
CUGCell cell;
m_ctrl->GetCellIndirect(m_btnCol,m_btnRow,&cell);
// make sure that the read only cells do not show droplist
if ( cell.GetReadOnly() == TRUE )
return UG_SUCCESS;
//get the current row and col
m_btnCol = m_ctrl->GetCurrentCol();
m_btnRow = m_ctrl->GetCurrentRow();
//add the strings to the CStringList
CString string;
cell.GetLabelText(&string);
items = &string;
len = items->GetLength();
pos =0;
startpos =0;
while(pos <len){
if(items->GetAt(pos)== _T('\n')){
list.AddTail(items->Mid(startpos,pos-startpos));
startpos = pos+1;
}
pos++;
}
//notify the user of the list, so it can be modified if needed
if ( OnCellTypeNotify(m_ID,m_btnCol,m_btnRow,UGCT_DROPLISTSTART,(LONG_PTR)&list) == FALSE )
// if FALSE was returned from OnCellTypeNotify call, than the developer does not
// wish to show the drop list at the moment.
return UG_ERROR;
// set default font height
lf.lfHeight = 12;
//get the font
if(cell.IsPropertySet(UGCELL_FONT_SET))
font = cell.GetFont();
else if(m_ctrl->m_GI->m_defFont != NULL)
font = m_ctrl->m_GI->m_defFont;
if(font == NULL)
font = CFont::FromHandle((HFONT)GetStockObject(SYSTEM_FONT));
if(font != NULL)
{
//find the height of the font
cfont = font;
cfont->GetLogFont(&lf); // lf.lfHeight
if( lf.lfHeight < 0 ){
HDC hDC = CreateCompatibleDC(NULL);
lf.lfHeight = -MulDiv(lf.lfHeight, GetDeviceCaps(hDC, LOGPIXELSY), 72);
DeleteDC(hDC);
}
}
//get the rectangle for the listbox
m_ctrl->GetCellRect(m_btnCol,m_btnRow,&rect);
rect.top = rect.bottom;
rect.left+=10;
rect.right+=10;
len = (int)list.GetCount();
if(len >15)
len = 15;
rect.bottom += lf.lfHeight * len + 6;
m_ctrl->m_CUGGrid->GetClientRect(&clientRect);
if(rect.bottom > clientRect.bottom){
dif = rect.bottom - clientRect.bottom;
rect.bottom -= dif;
//.........这里部分代码省略.........
示例13: Eclass_hasModel
qboolean Eclass_hasModel(eclass_t *e, vec3_t &vMin, vec3_t &vMax)
{
if (e->modelpath != NULL)
{
if (e->model == NULL)
{
e->model = reinterpret_cast<entitymodel_t*>(qmalloc(sizeof(entitymodel_t)));
}
char *pModelBuff = strdup(e->modelpath);
char *pSkinBuff = NULL;
if (e->skinpath)
{
pSkinBuff = strdup(e->skinpath);
}
CStringList Models;
CStringList Skins;
char* pToken = strtok(pModelBuff, ";\0");
while (pToken != NULL)
{
Models.AddTail(pToken);
pToken = strtok(NULL, ";\0");
}
if (pSkinBuff != NULL)
{
pToken = strtok(pSkinBuff, ";\0");
while (pToken != NULL)
{
Skins.AddTail(pToken);
pToken = strtok(NULL, ";\0");
}
}
entitymodel *model = e->model;
int i = 0;
for (; i < Models.GetCount(); i++)
{
char *pSkin = NULL;
if (i < Skins.GetCount())
{
pSkin = Skins.GetAt(Skins.FindIndex(i)).GetBuffer(0);
}
LoadModel(Models.GetAt(Models.FindIndex(i)), e, vMin, vMax, model, pSkin);
model->pNext = reinterpret_cast<entitymodel_t*>(qmalloc(sizeof(entitymodel_t)));
model = model->pNext;
}
// at this poitn vMin and vMax contain the min max of the model
// which needs to be centered at origin 0, 0, 0
VectorSnap(vMin);
VectorSnap(vMax);
if (vMax[0] - vMin[0] < 2)
{
vMin[0] -= 1;
vMax[0] += 1;
}
if (vMin[1] - vMax[1] < 2)
{
vMin[1] -= 1;
vMax[1] += 1;
}
if (vMax[2] - vMin[2] < 2)
{
vMax[2] -= 1;
vMax[2] += 1;
}
vec3_t vTemp;
VectorAdd(vMin, vMax, vTemp);
VectorScale(vTemp, 0.5, vTemp);
model = e->model;
while (model != NULL)
{
for (i = 0; i < model->nTriCount; i++)
{
for (int j = 0; j < 3; j++)
{
;//VectorSubtract(model->pTriList[i].v[j], vTemp, model->pTriList[i].v[j]);
}
}
model = model->pNext;
}
free(pModelBuff);
free(e->modelpath);
e->modelpath = NULL;
if(e->skinpath)
{
free(e->skinpath);
e->skinpath = NULL;
free(pSkinBuff);
}
}
//.........这里部分代码省略.........
示例14: OnGet
void CDlgIDirectoryObject::OnGet()
{
CStringList sList;
UINT nCount;
HRESULT hr;
UpdateData(TRUE);
StringToStringList(m_sAttributes, sList );
nCount = sList.GetCount();
if ( nCount == 0 )
{
return;
}
///////////////////////////////////////
// Now build the Attribute Names List
///////////////////////////////////////
POSITION pos;
DWORD dwNumAttr;
LPWSTR *pAttrNames=NULL;
ADS_ATTR_INFO *pAttrInfo;
DWORD dwReturn;
USES_CONVERSION;
pAttrNames = (LPWSTR*) AllocADsMem( sizeof(LPWSTR) * nCount );
pos = sList.GetHeadPosition();
dwNumAttr = 0;
while( pos != NULL )
{
pAttrNames[dwNumAttr] = T2OLE(sList.GetAt(pos));
dwNumAttr++;
sList.GetNext(pos);
}
/////////////////////////////////////////
// Get attributes value requested
// Note: The order is not necessarily the same as
// requested via pAttrNames.
///////////////////////////////////////////
hr = m_pDirObject->GetObjectAttributes( pAttrNames, dwNumAttr, &pAttrInfo, &dwReturn );
if ( SUCCEEDED(hr) )
{
DWORD idx;
CString sDisplay;
CStringList sValueList;
UINT nCount;
POSITION pos;
m_cValueList.ResetContent();
for( idx=0; idx < dwReturn; idx++)
{
ADsToStringList( pAttrInfo[idx].pADsValues, pAttrInfo[idx].dwNumValues, sValueList );
sDisplay = OLE2T(pAttrInfo[idx].pszAttrName);
sDisplay += _T(":");
m_cValueList.AddString( sDisplay );
nCount = sValueList.GetCount();
if ( nCount == 0 ) // can not find/convert the value
{
m_cValueList.AddString(_T(" > [No Value]"));
continue;
}
else
{
pos = sValueList.GetHeadPosition();
while( pos != NULL )
{
sDisplay = _T(" > ");
sDisplay += sValueList.GetAt(pos);
m_cValueList.AddString( sDisplay );
sValueList.GetNext(pos);
}
}
}
sValueList.RemoveAll();
}
///////////////////////////////////////////////////////////
// Use FreADsMem for all memory obtained from ADSI call
/////////////////////////////////////////////////////////////
FreeADsMem( pAttrInfo );
FreeADsMem( pAttrNames );
//.........这里部分代码省略.........