本文整理汇总了C++中CStringArray::SetAtGrow方法的典型用法代码示例。如果您正苦于以下问题:C++ CStringArray::SetAtGrow方法的具体用法?C++ CStringArray::SetAtGrow怎么用?C++ CStringArray::SetAtGrow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CStringArray
的用法示例。
在下文中一共展示了CStringArray::SetAtGrow方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EnumRegistryKeys
CStringArray * EnumRegistryKeys(HKEY root, const CString & group)
{
CString path;
CStringArray * keys;
TCHAR itemName[512];
path.LoadString(IDS_PROGRAM_ROOT);
path += _T("\\");
path += group;
HKEY key;
LONG result = makeKey(root, path, &key);
if(result != ERROR_SUCCESS)
return NULL;
keys = new CStringArray;
DWORD i = 0;
while(TRUE) //lint -e716
{ /* loop */
result = ::RegEnumKey(key, i, itemName, sizeof(itemName)/sizeof(TCHAR));
if(result != ERROR_SUCCESS)
break;
// we have a valid key name
keys->SetAtGrow(i, itemName);
i++;
} /* loop */
::RegCloseKey(key);
return keys;
}
示例2: AddMapItems
void AddMapItems(CStringArray& aKeys,CStringArray& aTitles, const char* szKey, const char* szDsc)
{
for(int i=0;i<aKeys.GetSize();i++){
if(aKeys[i]==szKey){
return;
}
}
aTitles.SetAtGrow(aKeys.Add(szKey),szDsc);
}
示例3: 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;
}
示例4: EnumRegistryValues
CStringArray * EnumRegistryValues(HKEY root, const CString & group)
{
CString path;
CStringArray * keys;
TCHAR itemName[512];
path.LoadString(IDS_PROGRAM_ROOT);
path += _T("\\");
path += group;
HKEY key;
LONG result = makeKey(root, path, &key);
if(result != ERROR_SUCCESS)
return NULL;
keys = new CStringArray;
DWORD i = 0;
while(TRUE)
{ /* loop */
DWORD length = sizeof(itemName)/sizeof(TCHAR);
result = ::RegEnumValue(key, // key selection
i, // which key
itemName, // place to put value name
&length, // in: length of buffer
// out: length of name
NULL, // reserved, NULL
NULL, // place to put type
NULL, // place to put value
NULL); // place to put value length
if(result != ERROR_SUCCESS)
break;
// we have a valid key name
keys->SetAtGrow(i, itemName);
i++;
} /* loop */
::RegCloseKey(key);
return keys;
}
示例5: Chop
int CUtils::Chop(LPCTSTR psz,CStringArray &ar,LPCTSTR pszSep,bool bObserveStrings/*=false*/,bool bBackslashQuotes/*=false*/)
{
ar.RemoveAll();
int i=0;
for(;;){
// Skip multiple separators
while(*psz&&_tcschr(pszSep,*psz)){
psz++;
}
if(!*psz){
return i;
}
CString strTok;
if(bObserveStrings){
BOOL bInString=FALSE;
do{
if(*psz==_TCHAR('\\') && bBackslashQuotes && psz[1]){
strTok+=psz[1];
psz++;
} else if(*psz==_TCHAR('"')){
bInString ^= 1;
} else if (!bInString && *psz && NULL!=_tcschr(pszSep,*psz)) {
break;
} else {
strTok+=*psz;
}
} while (*++psz);
} else {
LPCTSTR pszStart=psz;
do {
psz++;
} while (*psz && !_tcschr(pszSep,*psz));
strTok=CString(pszStart,psz-pszStart);
}
ar.SetAtGrow(i++,strTok);
}
return ar.GetSize();
}
示例6: DrawText
void CxStatic::DrawText(CDC* pDCMem, CRect* pRect, CString csText)
{
DWORD dwStyle = m_dwTxtFlags;
DWORD dwFlags = 0;
// Map "Static Styles" to "Text Styles" - WARNING MACROS
#define MAP_STYLE(src, dest) if(dwStyle & (src)) dwFlags |= (dest)
#define NMAP_STYLE(src, dest) if(!(dwStyle & (src))) dwFlags |= (dest)
MAP_STYLE( SS_RIGHT, DT_RIGHT );
MAP_STYLE( SS_CENTER, DT_CENTER );
MAP_STYLE( SS_LEFT, DT_LEFT );
//MAP_STYLE( SS_CENTERIMAGE, DT_VCENTER | DT_SINGLELINE );
MAP_STYLE( SS_NOPREFIX, DT_NOPREFIX );
MAP_STYLE( SS_WORDELLIPSIS, DT_WORD_ELLIPSIS );
MAP_STYLE( SS_ENDELLIPSIS, DT_END_ELLIPSIS );
MAP_STYLE( SS_PATHELLIPSIS, DT_PATH_ELLIPSIS );
// TAb expansion
if (csText.Find( _T('\t') ) != -1)
dwFlags |= DT_EXPANDTABS;
//csText.Replace(
// TEXT WRAPPING - Inspired by Chen-Cha Hsu and improved
CRect newRC;
TEXTMETRIC tag;
CSize sz;
::GetTextExtentPoint32(pDCMem->GetSafeHdc(), csText,csText.GetLength(), &sz);
CStringArray asText;
int nLine = 0;
CString s2;
int nX = 0;
int nId = 0;
char nCR = 0;
// Autowrapping mode enabled
if ( m_bAutoWrapping ){
for (int i = 1; i <= csText.GetLength(); i++){
s2 = csText.Left(i);
//CARRIAGE RETURN not recognised with SS_CENTERIMAGE - manual handling
if (csText.GetAt(i-1) == '\r' || csText.GetAt(i-1) == '\n'){
if (nCR == 0){
nCR = csText.GetAt(i-1);
}
else if (nCR != csText.GetAt(i-1)){ // "\r\n" or "\n\r"
s2 = csText.Left(i-2);
asText.Add(s2);
csText = csText.Mid(i);
i = nCR = 0;
}
}
::GetTextExtentPoint32(pDCMem->GetSafeHdc(), s2, s2.GetLength(), &sz);
if ( sz.cx > pRect->Width() ){// We found how many letters fits
s2 = csText.Left(i-1);
if ( IsASingleWord(s2) ){
asText.Add(s2);
csText = csText.Mid(i-1);
i = 0;
}
else{ // Do not break a word
nId = s2.ReverseFind(' ');
s2 = s2.Left(nId);
asText.Add(s2);
csText = csText.Mid(nId + 1);
i = 0;
}
}
}
if ( ! csText.IsEmpty() )
asText.Add(csText);
}
else{// Standard CStatic behaviour
asText.SetAtGrow(0, csText);
}
nLine = asText.GetSize();
pDCMem->GetTextMetrics(&tag);
newRC = *pRect;
LONG nDiff = pRect->bottom - pRect->top - tag.tmHeight * nLine;
if (dwStyle & SS_CENTERIMAGE)
pRect->top = nDiff/2;
//TRACE( "The value of nDiff is %d\n", nDiff );
if (m_bAutoAdjustFont){
if (nDiff < 0){
m_nFontSizeVar--;
SetFont( m_lf.lfFaceName, m_nFontSizeVar, m_lf.lfWeight );
}
//pDCMem->SelectObject( m_pFont ); TODO CHECK WITH AUTOADJUST
//RedrawWindow();
}
for (int j = 0; j < nLine; j++){
newRC.top = pRect->top + tag.tmHeight * j;
pDCMem->DrawText(asText[j], &newRC,dwFlags);
if (m_bFont3d){
if (m_3dType == Raised)
newRC.OffsetRect(-1,-1);
else
newRC.OffsetRect(1,1);
//.........这里部分代码省略.........
示例7: WKTrayMenuPopup
int WINAPI WKTrayMenuPopup(int iActionType, int& iItemId, HMENU hMenu)
{
if(!bAddTrayMenu){
return 0;
}
if(iActionType==TM_ADDCUSTOMITEM){
aRKeys.RemoveAll();
iIdBeginning=iItemId;
int iCount=0;
_SortReminders srp=(_SortReminders)GetProcAddress(hRemin,"SortReminders");
if(srp){
(*srp)();
}
_GetReminder fp=(_GetReminder)GetProcAddress(hRemin,"GetReminder");
COleDateTime dtNow=COleDateTime::GetCurrentTime();
HMENU mn=CreatePopupMenu();
int iPos=0;
CString sText;
char szKey[64]={0};
sprintf(szKey,"#%i",iCount);
CWPReminder rem;
while((*fp)(szKey,rem)){
COleDateTime tm(rem.EventTime);
sText=GetRemDsc(rem,TRUE);
if(sText!="" && abs(tm-dtNow)<=14 && !rem.bDisableRemider){
AppendMenu(mn,MF_STRING,iItemId,sText);
aRKeys.SetAtGrow(iPos,rem.szKey);
iPos++;
}
iItemId++;//Увеличиваем на все, даже на пустые!
iCount++;
rem.Clear();
sprintf(szKey,"#%i",iCount);
}
//if(iPos>0)//Всегда
{
{
iAddNew=iItemId;
iItemId++;
AppendMenu(mn,MF_STRING,iAddNew,_l2("Add new reminder"));
}
{
iShowAll=iItemId;
iItemId++;
AppendMenu(mn,MF_STRING,iShowAll,_l2("Show calendar"));
}
AppendMenu(hMenu,MF_POPUP|MF_STRING,UINT(mn),_l2("Reminders"));
}
}else{
if(iItemId==iShowAll){
ShowMainDialog(0);
}else if(iItemId==iAddNew){
//WKCallPluginFunction(0,0);
//CreateRemOnDate(0,COleDateTime::GetCurrentTime(),FALSE);
CString sSelectedKey=calcNextPrefixedId(DEF_ID);
char szEvent[128]={0};
strcpy(szEvent,sSelectedKey);
WKPluginShowEventX(szEvent,0,COleDateTime::GetCurrentTime(),0);
}else{
char szKey[64]={0};
strcpy(szKey,aRKeys[iItemId-iIdBeginning]);
WKPluginShowEventX(szKey,0,COleDateTime::GetCurrentTime(),0);
}
}
return 0;
}
示例8: lc
int WINAPI WKPluginShowEventX(char szEvent[128],HWND pParent,COleDateTime dt,BOOL bAskMenu)
{
static long l=0;
if(l>0){
return 0;
}
SimpleTracker lc(l);
CString sEventName=_l2("Scheduled event");
HINSTANCE hLLHookInst=GetModuleHandle("WP_KeyMaster.wkp");
_WKIHOTKEYS_GetHotkeyDscByID fpHk=(_WKIHOTKEYS_GetHotkeyDscByID)GetProcAddress(hLLHookInst,"WKIHOTKEYS_GetHotkeyDscByID");
BOOL bDef=(strcmp(szEvent,DEF_ID)==0);
if(fpHk){
char szTitle[256]={0};
if((*fpHk)(szEvent,szTitle,sizeof(szTitle))){
sEventName=szTitle;
}else{
sEventName=_l2("Attention! Time has come!");
}
}
_GetReminder fp=(_GetReminder)GetProcAddress(hRemin,"GetReminder");
_IsReminderFamilyPresent fpPr=(_IsReminderFamilyPresent)GetProcAddress(hRemin,"IsReminderFamilyPresent");
CString sRMKey=szEvent;
// Возможно нужен выбор?
CStringArray aTitles;
CStringArray aKeys;
if(bDef){
aTitles.SetAtGrow(0,_l2("Add new reminder"));
aKeys.SetAtGrow(0,sRMKey);
}else{
aTitles.SetAtGrow(0,_l2("Add new schedule"));
aKeys.SetAtGrow(0,sRMKey);
}
CString sSelectedKey="";
if(bAskMenu){
int iMaxIndex=0;
if(fpPr && (*fpPr)(sRMKey,&iMaxIndex)){
aKeys[0]="";
for(int i=0;i<=iMaxIndex;i++){
if(fp){
CWPReminder rem;
strcpy(rem.szKey,GetNextPrefixedId(sRMKey,i));
if((*fp)(rem.szKey,rem)){
AddMapItems(aKeys,aTitles, rem.szKey, GetRemDsc(rem,TRUE));
}
}
}
}
if(aKeys.GetSize()==1){
sRMKey=aKeys[0];
}else{
CMenu menu;
menu.CreatePopupMenu();
CPoint pt;
GetCursorPos(&pt);
for(int i=0;i<aKeys.GetSize();i++){
AddMenuString(&menu,WM_USER+i,aTitles[i]);
}
AddMenuString(&menu,WM_USER+aKeys.GetSize()+1,_l2("Close menu"));
int iNum=::TrackPopupMenu(menu.GetSafeHmenu(), TPM_RETURNCMD|TPM_NONOTIFY|TPM_RIGHTBUTTON, pt.x, pt.y, 0, pParent, NULL);
if(iNum==0 || iNum<WM_USER || iNum>=WM_USER+aKeys.GetSize()){
return 0;
}
sSelectedKey=aKeys[iNum-WM_USER];
if(sSelectedKey==""){
sSelectedKey=calcNextPrefixedId(sRMKey);
}
sRMKey=sSelectedKey;
}
}
BOOL bNewReminder=0;
CWPReminder rem;
memset(&rem,0,sizeof(CWPReminder));
if(fp && sRMKey!=""){
strcpy(rem.szKey,sRMKey);
if(!(*fp)(rem.szKey,rem)){
// Создаем новый!
bNewReminder=1;
//COleDateTime dt=COleDateTime::GetCurrentTime();
dt=dt+COleDateTimeSpan(0,0,1,0);
dt.GetAsSystemTime(rem.EventTime);
rem.bActPopup=bDef;
rem.bActSound=bActSound;
rem.bLoopSound=bLoopSound;
strcpy(rem.szText,sEventName);
strcpy(rem.szSoundPath,szWavFilePath);
if(!bDef){
// Здесь именно оригинальный Id-Event!!!
strcpy(rem.szReserved,szEvent);
}
_PutReminder fp2=(_PutReminder)GetProcAddress(hRemin,"PutReminder");
if(fp2){
(*fp2)(rem.szKey,rem);
}
}
}
#ifdef _DEBUG
WKGetPluginContainer()->ShowAlert(rem.szKey,"opened reminder");
#endif
_CallModifyReminder fp1=(_CallModifyReminder)GetProcAddress(hRemin,"CallModifyReminder");
//.........这里部分代码省略.........
示例9: CopyToClipboard
bool EventDlg::CopyToClipboard(bool bAll, bool bHeaders)
{
const PTCHAR _cediteol = "\r\n";
if ( !OpenClipboard() )
{
AfxMessageBox( "Cannot open the Clipboard" );
return true;
}
// Remove the current Clipboard contents
if( !EmptyClipboard() )
{
AfxMessageBox( "Cannot empty the Clipboard" );
return true;
}
// Get the currently selected data
int nItem, j, tlen, headeroffset;
const int ic = m_List.GetItemCount();
CStringArray a;
a.SetSize(ic);
tlen = 0;
headeroffset = 0;
if (bHeaders)
{
CString s;
for (j = efhFacility; j < efhHeaderCount; j++)
{
UINT icol = j; // direct mapping from header id to header string
s.Append(CFDMSApp::GetFileHeader(CSVFileHeaderIDs(icol)));
s.AppendChar('\t');
}
s.Append(_cediteol);
a.SetAtGrow(0, s);
tlen += s.GetLength();
headeroffset = 1;
}
// now for the rows
for (nItem = 0; nItem < ic; nItem++)
{
if (!bAll && !m_List.GetItemState(nItem, LVIS_SELECTED))
continue;
CString s = m_List.GetItemText(nItem,0);
for (j = efhFacility; j < efhHeaderCount; j++)
{
if (j == efhDischMonth || j == efhDischYear) // blend of three columns into one
continue;
if (j == efhMeasMonth || j == efhMeasYear) // blend
continue;
UINT icol = ImpEditCol::m_fileheadermap[j];
if (j == efhDischDay) // build combined disch date
{
COleDateTime dt = m_List.GetDateTime(nItem, icol);
s.Append(dt.Format("%d\t%m\t%Y"));
}
else
if (j == efhMeasDay) // build combined meas date
{
COleDateTime dt = m_List.GetDateTime(nItem, icol);
s.Append(dt.Format("%d\t%m\t%Y"));
}
else
if (j == efhStatus) // get status from the related globals
{
s.Append("0"); // the status of all entries in an import dialog is always unmeasured
}
else
if (j == efhMeasType) // convert string to number from the item text
{
CString cs;
cs.Format("%d", tImageToMeasurementType(m_List.GetItemText(nItem,icol)));
s.Append(cs);
}
else
s.Append(m_List.GetItemText(nItem,icol));
s.AppendChar('\t');
}
s.Append(_cediteol);
a.SetAtGrow(nItem + headeroffset, s);
tlen += s.GetLength();
}
// Allocate a global memory object for the text.
LPTSTR lptstrCopy;
HGLOBAL hglbCopy;
hglbCopy = GlobalAlloc(GMEM_MOVEABLE,
(tlen + 1) * sizeof(TCHAR));
if (hglbCopy == NULL)
{
CloseClipboard();
return true;
}
// Lock the handle and copy the text to the buffer.
lptstrCopy = (LPSTR)GlobalLock(hglbCopy);
lptstrCopy[0] = (TCHAR) 0; // null character
for (nItem = 0; nItem < a.GetCount(); nItem++)
{
LPSTR b = a[nItem].GetBuffer();
//.........这里部分代码省略.........
示例10: DecodeCfgData
//----------------------------- FUNCTION -------------------------------------*
BOOL
DecodeCfgData(CByteArray const* pCfg,
CStringArray& aTexts, CUIntArray& aOffsets, CUIntArray& aLengths,
int& iTotalInputs, int& iTotalOutputs, int& iTotalInAndOuts, int& iSeq)
/*>>>>
decode slave config data bytes to string
I pCfg: cfg data structure
O aTexts: array of texts to decoded config byte(s)
O aOffsets: array with start offsets of config sequence above
O iTotalInputs total bytes of inputs and outputs (incl. <iTotalInAndOuts> !)
O iTotalOutputs
O iTotalInAndOuts total bytes which allow input and output
0 iSeq number of config sequences = number of entries in arrays
Result
TRUE if ok
<<<<*/
{
int lenCfgData = pCfg->GetSize();
BYTE* pCfgData = (BYTE*) (pCfg->GetData());
CString sCfgText;
int cntDecodedBytes;
int iOffset = 0;
int lenRead, lenWrite, lenReadAndWrite;
BOOL bConfigOK = TRUE;
iTotalInputs = 0;
iTotalOutputs = 0;
iTotalInAndOuts = 0;
iSeq = 0;
while (lenCfgData > 0)
{
cntDecodedBytes = 0;
lenRead = 0;
lenWrite = 0;
lenReadAndWrite = 0;
if (::DecodeCfgBytes(pCfgData, sCfgText,
cntDecodedBytes, lenRead, lenWrite, lenReadAndWrite))
{
aTexts.SetAtGrow(iSeq, sCfgText);
aOffsets.SetAtGrow(iSeq, iOffset);
aLengths.SetAtGrow(iSeq, cntDecodedBytes);
iOffset += cntDecodedBytes;
lenCfgData -= cntDecodedBytes;
iTotalInputs += lenRead;
iTotalOutputs += lenWrite;
iTotalInAndOuts += lenReadAndWrite;
iSeq++;
}
else
{
TRACE0("DecodeCfgData: Bad config data bytes\n");
bConfigOK = FALSE;
break;
}
};
if (lenCfgData != 0)
{
ASSERT(FALSE);
bConfigOK = FALSE;
}
return bConfigOK;
}
示例11: OptionsDialogProc
//.........这里部分代码省略.........
}
if(uMsg==WM_COMMAND && wParam==IDOK){
bStopCheck=1;
csCheck.Lock();
csCheck.Unlock();
if(sListOfImagesToDelete.GetSize()>0){
if(dwDeleteOptions){
if(AfxMessageBox(Format("%s. %s: %i\n%s?",_l("Search for duplicated images: finished"),_l("Image(s) found"),sListOfImagesToDelete.GetSize(),_l("Do you really want to delete image(s)")),MB_YESNO|MB_ICONQUESTION)==IDYES){
for(int i=0;i<sListOfImagesToDelete.GetSize();i++){
char szPath[MAX_PATH+2]="";
memset(&szPath,0,sizeof(szPath));
strcpy(szPath,sListOfImagesToDelete[i]);
if(isFileExist(szPath)){
SHFILEOPSTRUCT str;
memset(&str,0,sizeof(str));
str.hwnd=hwndDlg;
str.wFunc=FO_DELETE;
str.pFrom=szPath;
str.pTo=NULL;
str.fFlags=FOF_ALLOWUNDO|FOF_NOCONFIRMATION|FOF_SILENT;
SHFileOperation(&str);
lDeletedFiles++;
}
}
}
}else{
lDeletedFiles+=sListOfImagesToDelete.GetSize();
}
}
if(bReplaceMode){
CString sDump;
int ik=0;
for(ik=0;ik<aClosestImage.GetSize();ik++){
sDump+=Format("%i -> %i, %i %s\n",ik,aClosestImage[ik],aClosestImageTaken[ik],sListOfImages[ik]);
aClosestImageTaken[ik]=0;
}
int iCnt=0;
int iJumper=-1;
CStringArray aFrom;
CStringArray aFromTo;
while(1){
if(iJumper==-1){
// Ищем первую картинку
for(ik=0;ik<aClosestImage.GetSize();ik++){
if(aClosestImageTaken[ik]==0){
iJumper=ik;
break;
}
}
}
if(iJumper==-1){
// Не нашли!!
break;
}
aClosestImageTaken[iJumper]=1;// Чтобы не циклится
int iNext=aClosestImage[iJumper];
if(iNext==-1 || aClosestImageTaken[iNext]!=0){
iJumper=-1;
continue;
}
CString sFrom=sListOfImages[iJumper];
CString sTo=Format("%s%05i_%s",GetPathPart(sFrom,1,1,0,0),iCnt+1,GetPathPart(sFrom,0,0,1,1));
aFrom.SetAtGrow(iCnt,sFrom);
aFromTo.SetAtGrow(iCnt,sTo);
sDump+=Format("Jumping %i -> %i\n",iJumper,iNext);
iJumper=iNext;
iCnt++;
}
SaveFile("f:\\rename.txt",sDump);
for(int i=0;i<aFrom.GetSize();i++)
{
if(isFileExist(aFrom[i])){
SHFILEOPSTRUCT str;
memset(&str,0,sizeof(str));
str.hwnd=hwndDlg;
str.wFunc=FO_RENAME;
char szPath[MAX_PATH+2]="";
memset(&szPath,0,sizeof(szPath));
strcpy(szPath,aFrom[i]);
str.pFrom=szPath;
char szPath2[MAX_PATH+2]="";
memset(&szPath2,0,sizeof(szPath2));
strcpy(szPath2,aFromTo[i]);
str.pTo=szPath2;
str.fFlags=FOF_NOCONFIRMATION|FOF_SILENT;
SHFileOperation(&str);
}
}
}
EndDialog(hwndDlg,0);
return TRUE;
}
if(uMsg==WM_NCDESTROY){
SetEvent(hStopEvent);
}
return FALSE;
}
示例12: CopyToClipboard
bool CMyListCtrl::CopyToClipboard(bool bAll, bool bHeaders)
{
const PTCHAR _cediteol = "\r\n";
if ( !OpenClipboard() )
{
AfxMessageBox( "Cannot open the Clipboard" );
return true;
}
// Remove the current Clipboard contents
if( !EmptyClipboard() )
{
AfxMessageBox( "Cannot empty the Clipboard" );
return true;
}
// Get the currently selected data
int nItem, j, tlen, headeroffset;
const int ic = GetItemCount();
CStringArray a;
a.SetSize(ic);
tlen = 0;
headeroffset = 0;
if (bHeaders)
{
CString s;
for (j = efhFacility; j < efhHeaderCount; j++)
{
UINT icol = j; // direct mapping from header id to header string
s.Append(CFDMSApp::GetFileHeader(CSVFileHeaderIDs(icol)));
s.AppendChar('\t');
}
s.Append(_cediteol);
a.SetAtGrow(0, s);
tlen += s.GetLength();
headeroffset = 1;
}
// now for the rows
for (nItem = 0; nItem < ic; nItem++)
{
if (!bAll && !GetItemState(nItem, LVIS_SELECTED))
continue;
CString s = GetItemText(nItem,0);
for (j = efhFacility; j < efhHeaderCount; j++)
{
if (j == efhDischMonth || j == efhDischYear) // blend of three columns into one, skip 2
continue;
if (j == efhMeasMonth || j == efhMeasYear) // blend of three columns into one, skip 2
continue;
UINT icol = CMeaCol::m_fileheadermap[j];
if (j == efhDischDay || j == efhMeasDay) // build combined disch date
{
int y = 0,m = 0,d = 0;
CString dt = GetItemText(nItem,icol);
if (dt.IsEmpty())
{
dt = ("\t\t");
}
else
{
CFieldDate::XConvert3(dt, y, m, d);
dt.Format("%d\t%d\t%d",d,m,y);
}
s.Append(dt);
}
else
if (j == efhStatus) // get status from the related globals
{
int iData;
iData = GetItemData(nItem);
if (iData >= 0 && iData < MP_ARRAYSIZE)
{
CString cs;
cs.Format("%d", g_iMPStatus[iData] );
s.Append(cs);
}
else
s.Append("0");
}
else
if (j == efhMeasType) // convert string to number from the item text
{
//CString cs;
//cs.Format("%d", tImageToMeasurementType(GetItemText(nItem,icol)));
s.Append(GetItemText(nItem,icol));
}
else
s.Append(GetItemText(nItem,icol));
s.AppendChar('\t');
}
s.Append(_cediteol);
a.SetAtGrow(nItem + headeroffset, s);
tlen += s.GetLength();
}
// Allocate a global memory object for the text.
LPTSTR lptstrCopy;
HGLOBAL hglbCopy;
hglbCopy = GlobalAlloc(GMEM_MOVEABLE,
//.........这里部分代码省略.........