Exemple #1
0
void InformApp::FindExtensions(void)
{
  m_extensions.clear();
  for (int i = 0; i < 2; i++)
  {
    CString path;
    switch (i)
    {
    case 0:
      path.Format("%s\\Internal\\Extensions\\*.*",(LPCSTR)GetAppDir());
      break;
    case 1:
      path.Format("%s\\Inform\\Extensions\\*.*",(LPCSTR)GetHomeDir());
      break;
    default:
      ASSERT(FALSE);
      break;
    }

    CFileFind find;
    BOOL finding = find.FindFile(path);
    while (finding)
    {
      finding = find.FindNextFile();
      if (!find.IsDots() && find.IsDirectory())
      {
        CString author = find.GetFileName();
        if (author == "Reserved")
          continue;
        if ((author.GetLength() > 0) && (author.GetAt(0) == '.'))
          continue;

        path.Format("%s\\*.*",(LPCSTR)find.GetFilePath());
        CFileFind find;
        BOOL finding = find.FindFile(path);
        while (finding)
        {
          finding = find.FindNextFile();
          if (!find.IsDirectory())
          {
            CString ext = ::PathFindExtension(find.GetFilePath());
            if (ext.CompareNoCase(".i7x") == 0)
              m_extensions.push_back(ExtLocation(author,find.GetFileTitle(),(i == 0),find.GetFilePath()));
            else if (ext.IsEmpty() && (i == 1))
            {
              // Rename an old-style extension (with no file extension) to end with ".i7x"
              CString newPath = find.GetFilePath();
              newPath.Append(".i7x");
              if (::MoveFile(find.GetFilePath(),newPath))
                m_extensions.push_back(ExtLocation(author,find.GetFileTitle(),(i == 0),newPath));
            }
          }
        }
        find.Close();
      }
    }
    find.Close();
  }
  std::sort(m_extensions.begin(),m_extensions.end());
}
void COptionsGeneral::FillLanguages()
{
	CString csFile = CGetSetOptions::GetPath(PATH_LANGUAGE);
	csFile += "*.xml";

	CString csLanguage = CGetSetOptions::GetLanguageFile();

	CFileFind find;
	BOOL bCont = find.FindFile(csFile);
	int nEnglishIndex = NO_MATCH;

	while(bCont)
	{
		bCont = find.FindNextFile();
		int nIndex = m_cbLanguage.AddString(find.GetFileTitle());

		if(find.GetFileTitle() == csLanguage)
		{
			nEnglishIndex = -1;
			m_cbLanguage.SetCurSel(nIndex);
		}
		else if(find.GetFileTitle() == _T("English"))
		{
			if(nEnglishIndex == NO_MATCH)
				nEnglishIndex = nIndex;
		}
	}

	if(nEnglishIndex >= 0)
	{
		m_cbLanguage.SetCurSel(nEnglishIndex);
	}
}
void CTaiKlineDlgHistorySelect::GetFileNameArray(CStringArray &sArry)
{
	CString sPath = "data\\historysh\\";
	CFileFind finder;
	int n = 0;
	BOOL bWorking = finder.FindFile(sPath+"*.hst");
	while(bWorking)
	{
	  bWorking = finder.FindNextFile();
	  CString filename = finder.GetFileTitle();
	  int nSize = sArry.GetSize ();
	  for(int j=0;j<nSize;j++)
	  {
		  if(filename <sArry[j])
		  {
			  sArry.InsertAt (j,filename);
			  break;
		  }
		  if(j==nSize-1)
			sArry.Add (filename);
	  }
	  if(nSize == 0)
			sArry.Add (filename);

	  n++;
	}
	sPath = "data\\historysz\\";
	n = 0;
	bWorking = finder.FindFile(sPath+"*.hst");
	while(bWorking)
	{
	  bWorking = finder.FindNextFile();
	  CString filename = finder.GetFileTitle();
	  int nSize = sArry.GetSize ();
	  BOOL bf;
	  bf=false;
	  for(int j=0;j<nSize;j++)
	  {
		  if(filename ==sArry[j])
		  {
			  bf=true;
			  
			  break;
			  
		  }
		  else
		  {
			  bf=false;
			  continue;
		  }
		  if(j==nSize-1)
			sArry.Add (filename);
	  }
	  if((nSize == 0)||(!bf))
			sArry.Add (filename);
	  n++;
	}
}
Exemple #4
0
void ShowDB()
{

	CFileFind finder;
	int iRowN = 0;
    int iNameLen = 0,iTemp = 0;
	std::cout<<"These are the databases !\n";
    int bWorking = finder.FindFile("..\\Data\\*.*");
	std::cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<'\n';//<---计32个字符
	std::cout<<"| Database                     |"<<'\n';
	std::cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<'\n';//<---计32个字符
	while(bWorking)
	{
		
      bWorking = finder.FindNextFile();
	  if (finder.IsDots())
         continue;
	  
      if (finder.IsDirectory())
      {
		 iRowN++;
         CString str = finder.GetFileTitle();
		 iNameLen = str.GetLength(); 
		 std::cout <<"| "<< (LPCTSTR) str;
		 for(iTemp = 29 - iNameLen;iTemp != 0;iTemp--)
			 std::cout<<' ';
		std::cout <<"|"<<'\n';
	  }   	  
	}
   	std::cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<'\n';//<---计32个字符
	std::cout<<"There are" <<iRowN<<" rows in the database!";
	finder.Close();
}
Exemple #5
0
void YpDirectory::GetDirectoryContain(vector<CString>& list)
{
	CFileFind ff;
	CString szDir = path;

	if(szDir.Right(1) != "\\")
	{
		szDir += "\\";
	}

	szDir += "*.*";

	BOOL res = ff.FindFile(szDir);
	const CString each = "{%s|%d|%s}";
	while(res)
	{
		res = ff.FindNextFile();
		CString temp;
		if (ff.IsDirectory() && !ff.IsDots())
		{
			temp.Format(each, ff.GetFileName(), 0, "Ŀ¼");
			list.push_back(temp);
		}
		else if(!ff.IsDirectory() && !ff.IsDots())
		{
			CFileStatus status;
			CString path = ff.GetFilePath();
			CFile::GetStatus(path, status);
			temp.Format(each, ff.GetFileName(), (UINT)(status.m_size / 1024.0), ff.GetFileTitle());
			list.push_back(temp);
		}
	}
	ff.Close();
}
Exemple #6
0
void CDlgArmLogICImage::UpdataFolderStatus()
{
	// Get the folder name
	m_Folder.RemoveAll();

	CString csFilePath = _T("");
	csFilePath = m.FilePath.ArmLogICImagePath;
	CFileFind finder;											//建立搜尋用的CFileFind物件
	BOOL bResult = finder.FindFile( csFilePath  + "*.*" );		//尋找第一個檔案
	while(bResult)
	{
		bResult = finder.FindNextFile();						//尋找下一個檔案
		if(!finder.IsDots() && finder.IsDirectory())
		{
			CString csFileDirectory = _T("");
			csFileDirectory.Format("%s", finder.GetFileTitle() );
			
			m_Folder.Add( csFileDirectory );
		}
	}
	
	m_listFolderStatus.ResetContent();
	int iSize = m_Folder.GetSize();
	for(int i=0;i<iSize;i++)
	{
		CString csFolderName = _T("");
		csFolderName = m_Folder.GetAt(i);
		m_listFolderStatus.AddString( csFolderName );
	}
	CString csFolderCounter = _T("");
	csFolderCounter.Format("Folder Counter: %d", iSize );
	m_wndlistFolderCounter.SetWindowText( csFolderCounter );
}
//////////////////////////////////////////////////////////////
//功能:同步图库与显示内容
//////////////////////////////////////////////////////////////
void CModuleWnd::OnUpdate()
{
	GetListCtrl()->DeleteAllItems();
	CString strName;

	if (m_pCurrentDocument == NULL) //显示库目录
	{	
		strName = CModuleDoc::GetDefaultPath() + _T("\\*.");
		strName += CModuleDoc::m_szModuleLibFileExt;
		CFileFind finder;
		BOOL bOk = finder.FindFile(strName);

		while(bOk)
		{
			bOk = finder.FindNextFile();
			strName = finder.GetFileTitle();
			GetListCtrl()->InsertItem(1, strName, MLW_ICON_FOLDER);
		}
	}
	else //显示库内容
	{
		int nCount = m_pCurrentDocument->GetModuleCount();
		for (int i = 0; i < nCount; i++)
		{
			CModuleDoc::CModule* pModule = m_pCurrentDocument->GetModule(i);
			GetListCtrl()->InsertItem(i, pModule->m_strName, i);
		}
	}
}
Exemple #8
0
UINT CLang::ScanLang(CString dirPath)
{
	CString langName;
	CString fileName;
	BOOL bFound;
	UINT pos;
	CFileFind cFF;
	
	bFound = cFF.FindFile(dirPath+"\\*.txt");
	if(bFound)
	{
		do
		{
			bFound = cFF.FindNextFile();//查下一个
			
			fileName = cFF.GetFileTitle();//
			if(fileName != _T("中文") && fileName != _T("English"))//不等时
			{
				pos = fileName.Find('.');//
				langName = fileName.Left(pos);//
				m_langName[m_langCount] = fileName;//
				m_langCount++;
			}
			
		}
		while(bFound);//
	}
	else
	{
		return 0;
	}

	return m_langCount-2;//
}
void SpellCheck::Initialize(void)
{
  if (spell != NULL)
    return;

  // Get long and short names for all possible dictionaries
  ::EnumSystemLocales(HandleLocale,LCID_SUPPORTED);

  // Set up the installed dictionaries
  CFileFind find;
  BOOL found = find.FindFile(theApp.GetAppDir()+"\\Dictionaries\\*.dic");
  while (found)
  {
    found = find.FindNextFile();
    std::map<std::string,std::string>::const_iterator it = allLanguages.find((LPCSTR)find.GetFileTitle());
    if (it != allLanguages.end())
      languages.insert(std::make_pair(it->second,it->first));
  }

  // Load registry settings
  char fileName[MAX_PATH] = "";
  CRegKey registryKey;
  if (registryKey.Open(HKEY_CURRENT_USER,"Software\\David Kinder\\Inform\\Spelling",KEY_READ) == ERROR_SUCCESS)
  {
    ULONG len = sizeof fileName;
    if (registryKey.QueryStringValue("Language",fileName,&len) != ERROR_SUCCESS)
      strcpy(fileName,"");
  }

  // As the default, use the UK English dictionary for UK English, otherwise US English
  if (fileName[0] == '\0')
  {
    switch (::GetUserDefaultLangID())
    {
    case MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_UK):
      strcpy(fileName,"en_GB");
      break;
    default:
      strcpy(fileName,"en_US");
      break;
    }
  }

  // Select an initial current language
  currentLanguage = languages.begin();
  for (StrPairSet::iterator it = languages.begin(); it != languages.end(); ++it)
  {
    if (it->second == fileName)
      currentLanguage = it;
  }
  InitSpellObject();
}
/**
desc:			获取某文件夹下的文件全路径名

strPath:		文件夹路径
strarrFileList: 保存文件列表的字符串数组

return:			返回 当前程序所在路径
*/
int CommonStrMethod::GetNameListOfDir(CString strPath, CStringArray& strarrFileList)
{
	CFileFind finder;
	BOOL bFound = finder.FindFile(strPath);
	int nCount = 0;
	for(; bFound; nCount++)
	{
		bFound = finder.FindNextFile();
		strarrFileList.Add(finder.GetFileTitle());
	}
	finder.Close();
	return nCount;
}
Exemple #11
0
BOOL CMultiplay::OnInitDialog() 
{
		CDialog::OnInitDialog();

		if (!theApp.recording_ && theApp.mac_.size() > 0)
			name_ctrl_.AddString(DEFAULT_MACRO_NAME);

		// Find all .hem files in macro dir
		CFileFind ff;
		ASSERT(theApp.mac_dir_.Right(1) == "\\");
		BOOL bContinue = ff.FindFile(theApp.mac_dir_ + "*.hem");

		while (bContinue)
		{
			// At least one match - check them all
			bContinue = ff.FindNextFile();

			// Hide macro files beginning with underscore unless recording.
			// This is so that "sub-macros" are not normally seen but can be
			// selected when recording a macro that invokes them.
			if (theApp.recording_ || ff.GetFileTitle().Left(1) != "_")
				name_ctrl_.AddString(ff.GetFileTitle());
		}
		ASSERT(name_ctrl_.GetCount() > 0);
		name_ctrl_.SetCurSel(0);

		ASSERT(GetDlgItem(IDC_SPIN_PLAYS) != NULL);
		((CSpinButtonCtrl *)GetDlgItem(IDC_SPIN_PLAYS))->SetRange(1, UD_MAXVAL);

		ASSERT(GetDlgItem(IDC_PLAYS) != NULL);
		ASSERT(GetDlgItem(IDC_DESC_PLAYS) != NULL);
		ASSERT(GetDlgItem(IDC_SPIN_PLAYS) != NULL);
		GetDlgItem(IDC_PLAYS)->EnableWindow(!theApp.recording_);
		GetDlgItem(IDC_DESC_PLAYS)->EnableWindow(!theApp.recording_);
		GetDlgItem(IDC_SPIN_PLAYS)->EnableWindow(!theApp.recording_);
		FixControls();

		return TRUE;
}
Exemple #12
0
CString	CStkUIApp::GetNextNewStrategyTitle( CString & strExtBuffer, CString strPath )
{
	CString	string;
	VERIFY( string.LoadString( IDS_STRATEGY_NONAME ) );

	CString strExt	=	AfxGetStrategyFileExt( );
	if( !strExt.IsEmpty())
		strExtBuffer	=	strExt;

	CStringArray	astrExistTitle;
	POSITION pos = GetFirstStrategyPosition();
	while( NULL != pos )
	{
		CStrategy * pStrategy = GetNextStrategy( pos );
		astrExistTitle.Add( AfxGetFileTitleNoExt(pStrategy->GetPathName()) );
	}

	CFileFind finder;
	BOOL	bWorking	=	finder.FindFile( AfxGetFilePath( (LPCTSTR)strPath, LPCTSTR("*" + strExt) ) );
	while( bWorking )
	{
		bWorking	=	finder.FindNextFile();
		astrExistTitle.Add( finder.GetFileTitle( ) );
	}
	finder.Close();

	for( int i=1; ; i++ )
	{
		CString	strTemp;
		strTemp.Format( "%s(%d)", string, i );
		
		BOOL	bHas	=	FALSE;
		for( int k=0; k<astrExistTitle.GetSize(); k++ )
		{
			if( 0 == strTemp.CompareNoCase( astrExistTitle.ElementAt(k) ) )
			{
				bHas	=	TRUE;
				break;
			}
		}
		
		if( !bHas )
		{
			string	=	strTemp;
			break;
		}
	}
	return string;
}
void CSelectVectorDlg::FillBox()
{
	 CFileFind  vectordir;
	 char chpath[MAX_PATH];  
	 GetModuleFileName(NULL,(LPSTR)chpath,sizeof(chpath));  
	 CString file;//=theApp.GetDirectory();
	 file.Format("%s",chpath);
	 CString vectorname;
	 file+="global\\vec\\*.vec";

	 m_list.ResetContent();
	 if (vectordir.FindFile(file))
	 {
	   while (vectordir.FindNextFile())
		{
			 vectorname=vectordir.GetFileTitle();
			 m_list.AddString(vectorname);
		}
	  vectorname=vectordir.GetFileTitle();
	  m_list.AddString(vectorname);

		vectordir.Close();
	}
}
Exemple #14
0
BOOL CTutInfo::BuildList()
{
   // find all the "tut" DLLs and load their resource strings

   CFileFind find;
   if (find.FindFile("*.*"))
   {
      CString filename;
      DWORD num = 0;
      BOOL more = TRUE;
      do
      {
         more = find.FindNextFile();
         CString tutDir = find.GetFileTitle();

         if (!find.IsDirectory() || find.IsDots() || tutDir == "")
            continue;

			CString filename = tutDir;
			if (filename.GetLength() > 8)
			{
				filename = filename.Left(8);
			}
         filename += ".tut";

         CString filepath = tutDir + "\\Release\\" + filename;
         HINSTANCE handle = LoadLibrary(filepath);

         if (handle)
         {
            cout << "Reading " << filepath << '\n';
            cout.flush();

            TUTINFO* pTut = new TUTINFO;

            pTut->csFilename = filename;

            // Get ID and Title from resource string
            char buf[512];
            LoadString(handle, IDS_TUTORIAL_INFO, buf, sizeof(buf));
            pTut->csInfo = buf;
            m_TutList.Add(pTut);
            FreeLibrary(handle);
         }
      } while (more);
   }
   return TRUE;
}
	_declspec(dllexport) void morph::loadAllModels(LPTSTR directoryPath, 
		std::vector<std::vector<morphPoint>*> *landMarkSets, 
		std::vector<std::vector<morphPoint>*> *densePointsSets)
	{
		for(int i=0; i<landMarkSets->size(); i++)
		{
			delete landMarkSets->at(i);
		}
		landMarkSets->clear();

		for(int i=0; i<densePointsSets->size();i++)
		{
			delete densePointsSets->at(i);
		}
		densePointsSets->clear();

		CString allFilePath;
		allFilePath.Append(directoryPath);
		allFilePath.Append(_T("*.pp"));
		CFileFind ppFinder;
		bool isAny=ppFinder.FindFile(allFilePath.GetBuffer(0));
		int num=0;
		while(isAny!=0)
		{
			isAny=ppFinder.FindNextFile();
			num++;
			std::vector<morphPoint> *vec=new std::vector<morphPoint>();
			readControlPointsFromPP((*vec), ppFinder.GetFilePath().GetBuffer(0));
			landMarkSets->push_back(vec);

			CString plyFilePath;
			plyFilePath.Append(directoryPath);
			plyFilePath.Append(_T("RegisteredFaces\\"));
			plyFilePath.Append(ppFinder.GetFileTitle());
			plyFilePath.Append(_T("_registered"));
			plyFilePath.Append(_T(".ply"));
			std::vector<morphPoint> *model=new std::vector<morphPoint>();
			readDensePointsFromPLY((*model),plyFilePath.GetBuffer(0));
			densePointsSets->push_back(model);
		}
	}
Exemple #16
0
void ShowTable()
{
    CFileFind finder;

    int iRowN = 0;
    char loc[256];
	CString Dbn(CurDB);
    int iNameLen = 0,iTemp = 0;
	std::cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<'\n';
	std::cout<<"| Tables in ";
    std::cout << (LPCTSTR) Dbn;
    int strNum = Dbn.GetLength();
	for(iTemp = 19 - iNameLen-strNum;iTemp != 0;iTemp--)
		 std::cout<<' ';
	std::cout <<"|"<<'\n';
	std::cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<'\n';
	strcpy(loc,CurLocation);
	strcat(loc,"*.dbf");
    int bWorking = finder.FindFile(loc);

	while(bWorking)
	{
		 bWorking = finder.FindNextFile();
		 if (finder.IsDots())
			continue;
		 iRowN++;
         CString str = finder.GetFileTitle();
         iNameLen = str.GetLength(); 
		 std::cout <<"| "<< (LPCTSTR) str;
		 for(iTemp = 29 - iNameLen;iTemp != 0;iTemp--)
			 std::cout<<' ';
		std::cout <<"|"<<'\n';
	}
	std::cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<'\n';
	std::cout<<"There are" <<iRowN<<" rows in the table!";
	finder.Close();

}
void CStringExt::EnumAllSubs(LPCTSTR folder,LPCTSTR types,LPCTSTR typeSep,
							 void (*cb)(LPCTSTR path,LPCTSTR fileName,LPCTSTR fileType,DWORD extraData),bool bSubFilesOnly,DWORD extraData)
{
	CString path(folder);
	CFileFind find;
	BOOL bWorking =find.FindFile(path+_T("\\*.*"));//查找文件
	if(!bWorking){find.Close();return;}
	while (bWorking)
	{
		bWorking = find.FindNextFile();
		if(find.IsDots()) continue;
		if(find.IsDirectory())
		{
			if(bSubFilesOnly) continue;
			else EnumAllSubs(path+_T("\\")+find.GetFileName(),types,typeSep,cb,bSubFilesOnly,extraData);
		}
		else
		{
			CString strTypes(types);
			strTypes=typeSep+strTypes+typeSep;
			strTypes.MakeLower();
			CString fn(find.GetFileName());
			CString ext=GetFileExt(fn,_T(""));
			bool bEnumIt=false;
			if(strTypes.Find(CString(typeSep)+_T("*")+typeSep)>-1 || strTypes.Find(CString(typeSep)+_T("*.*")+typeSep)>-1)
				bEnumIt=true;//*.*
			else if(ext.IsEmpty() &&
				(strTypes.Find(CString(typeSep)+_T("[empty]")+typeSep)>-1 || strTypes.Find(CString(typeSep)+_T("[null]")+typeSep)>-1))
				bEnumIt=true;//无后缀或后缀名为空
			else if(strTypes.Find(typeSep+ext+typeSep)>-1 || strTypes.Find(typeSep+(_T("*.")+ext)+typeSep)>-1)
				bEnumIt=true;//指定后缀
			if(bEnumIt) (*cb)(folder,find.GetFileTitle(),ext,extraData);
		}
	}
	find.Close();
}
Exemple #18
0
BOOL CSelectConfigDlg::AddConfigFilesToControl( )
{
	CFileFind fileFind;
	CString sConfigFileSearch;

	// Create a search string to find all the config files in the config directory.
	sConfigFileSearch = GetProfileFile( "*" );
	BOOL bFound = fileFind.FindFile( sConfigFileSearch );
	while( bFound )
	{
		// Get the information about the file found and continue the search.
		bFound = fileFind.FindNextFile( );
		
		// Skip directories and dots.
		if( fileFind.IsDirectory( ) || fileFind.IsDots( ))
			continue;

		// Add just the title of the file to the control.  Don't add the path
		// or the extension.  The serverdlg will figure it out.
		m_ConfigCtrl.AddString( fileFind.GetFileTitle( ));
	}

	return TRUE;
}
/**
	@brief	

	@author BHK	

	@date 2009-04-28 오전 11:10:50	

	@param	

	@return		
*/
void CSaveProductToRevisionDlg::OnBnClickedOk()
{
	char* pData = NULL;

	CELoadDocData& docData = CELoadDocData::GetInstance();
	
	InsertLoadItemInCableSizingResultDoc();

	const string rMDBFilePath = docData.GetProjectMDBFilePath();

	CADODB adoDB;
	const STRING_T rConnectionString = STRING_T(PROVIDER) + _T("Data Source=") + rMDBFilePath + DB_PASSWORD;
	if(TRUE == adoDB.DBConnect(rConnectionString))
	{
		CString strDesc;
		GetDlgItemText(IDC_EDIT_DESC , strDesc);

		CString strZipFilePath;
		map<CString , CString > ZipFilePathMap;
		if((_T("LOAD SUMMARY-BUS") == m_rProductName) || (_T("LOAD SUMMARY-SUBBUS") == m_rProductName))
		{
			strZipFilePath = string(docData.GetProjectFolderPath() + _T("Load Summary Result\\BUS_LoadSummary.zip")).c_str();
			ZipFilePathMap.insert(make_pair(_T("Load Summary-BUS") , strZipFilePath));
			strZipFilePath = string(docData.GetProjectFolderPath() + _T("Load Summary Result\\SubBUS_LoadSummary.zip")).c_str();
			ZipFilePathMap.insert(make_pair(_T("Load Summary-SubBUS") , strZipFilePath));
		}
		else if(_T("TRANSFORMER SIZING") == m_rProductName)
		{
			CTransformerSizingResultDoc::SaveTransformerSizingResultData();

			CZipArchive zip;
			CString strProjectPath = docData.GetProjectFolderPath().c_str();
			strZipFilePath = strProjectPath + _T("Transformer Sizing\\Transformer Sizing.zip");
			{
				if(!strZipFilePath.IsEmpty())
				{
					zip.Open(strZipFilePath , CZipArchive::create );
					zip.AddNewFile(strProjectPath + _T("Transformer Sizing\\Transformer Sizing.txt") , -1 , false);
					zip.Close();
				}
			}
			ZipFilePathMap.insert(make_pair(m_rProductName , strZipFilePath));
		}
		else if(_T("AUTO POWER CABLE") == m_rProductName)
		{
			CZipArchive zip;
			CString strProjectPath = docData.GetProjectFolderPath().c_str();
			strZipFilePath = strProjectPath + _T("Cable Sizing Result\\Cable Sizing Result.zip");
			{
				if(!strZipFilePath.IsEmpty())
				{
					zip.Open(strZipFilePath , CZipArchive::create );
					CString strDir = strProjectPath + CString(_T("Cable Sizing Result\\*.BUS"));
					CFileFind file;

					vector<string> rInterestingFileEntry;
					///! 확장자가 *.BUS 파일을 찾는다.
					BOOL bFound = file.FindFile(strDir);
					if(bFound)
					{
						while(bFound)
						{
							bFound = file.FindNextFile();
							if(file.IsDots()) continue;

							const CString rFileName = file.GetFileTitle().MakeUpper();
							zip.AddNewFile(strProjectPath + CString(_T("Cable Sizing Result\\")) + rFileName + _T(".BUS") , -1 , false);
						}
					}
					zip.Close();
				}
			}
			ZipFilePathMap.insert(make_pair(m_rProductName , strZipFilePath));
		}
		else if(_T("AUTO CONTROL CABLE") == m_rProductName)
		{
			CZipArchive zip;
			CString strProjectPath = docData.GetProjectFolderPath().c_str();
			strZipFilePath = strProjectPath + _T("Control Cable Result\\Control Cable Result.zip");
			{
				if(!strZipFilePath.IsEmpty())
				{
					zip.Open(strZipFilePath , CZipArchive::create );
					CString strDir = strProjectPath + CString(_T("Control Cable Result\\*.BUS"));
					CFileFind file;

					vector<string> rInterestingFileEntry;
					///! 확장자가 *.BUS 파일을 찾는다.
					BOOL bFound = file.FindFile(strDir);
					if(bFound)
					{
						while(bFound)
						{
							bFound = file.FindNextFile();
							if(file.IsDots()) continue;

							const CString rFileName = file.GetFileTitle().MakeUpper();
							zip.AddNewFile(strProjectPath + CString(_T("Control Cable Result\\")) + rFileName + _T(".BUS") , -1 , false);
						}
					}
					zip.Close();
				}
			}
			ZipFilePathMap.insert(make_pair(m_rProductName , strZipFilePath));
		}
		else if(_T("CABLE SIZING TABLE") == m_rProductName)
		{
			CZipArchive zip;
			CString strProjectPath = docData.GetProjectFolderPath().c_str();
			strZipFilePath = strProjectPath + _T("Cable Sizing Table\\Cable Sizing Table.zip");
			{
				if(!strZipFilePath.IsEmpty())
				{
					zip.Open(strZipFilePath , CZipArchive::create );
					
					CString strDir = strProjectPath + CString(_T("Cable Sizing Table\\*.TXT"));
					CFileFind file;

					vector<string> rInterestingFileEntry;
					///! 확장자가 *.TXT 파일을 찾는다.
					BOOL bFound = file.FindFile(strDir);
					if(bFound)
					{
						while(bFound)
						{
							bFound = file.FindNextFile();
							if(file.IsDots()) continue;

							const CString rFileName = file.GetFileTitle().MakeUpper();
							zip.AddNewFile(strProjectPath + CString(_T("Cable Sizing Table\\")) + rFileName + _T(".TXT") , -1 , false);
						}
					}

					zip.Close();
				}
			}
			ZipFilePathMap.insert(make_pair(m_rProductName , strZipFilePath));
		}
		else if((_T("CABLE SCHEDULE") == m_rProductName) || (_T("DRUM SCHEDULE") == m_rProductName))
		{
			CZipArchive zip;
			CString strProjectPath = docData.GetProjectFolderPath().c_str() , rKeyString;
			if(_T("Cable Schedule") == m_rProductName)
				rKeyString = _T("Cable Schedule Result");
			else	rKeyString = _T("Drum Schedule Result");
			strZipFilePath = strProjectPath + rKeyString + _T("\\") + rKeyString + _T(".zip");
			{
				if(!strZipFilePath.IsEmpty())
				{
					zip.Open(strZipFilePath , CZipArchive::create );
					
					CString strDir = strProjectPath + rKeyString + CString(_T("\\*.TXT"));
					CFileFind file;

					vector<string> rInterestingFileEntry;
					///! 확장자가 *.TXT 파일을 찾는다.
					BOOL bFound = file.FindFile(strDir);
					if(bFound)
					{
						while(bFound)
						{
							bFound = file.FindNextFile();
							if(file.IsDots()) continue;

							const CString rFileName = file.GetFileTitle().MakeUpper();
							zip.AddNewFile(strProjectPath + rKeyString + CString(_T("\\")) + rFileName + _T(".TXT") , -1 , false);
						}
					}

					zip.Close();
				}
			}
			ZipFilePathMap.insert(make_pair(m_rProductName , strZipFilePath));
		}

		if(!ZipFilePathMap.empty())
		{
			++m_nLastRevNo;
			for(map<CString , CString>::iterator itr = ZipFilePathMap.begin();itr != ZipFilePathMap.end();++itr)
			{
				CString strFormat = _T("INSERT INTO T_PRODUCT_REVISION(C_PRODUCT_NAME,C_REVISION_NO,C_DATE,C_DESC) VALUES('%s',%d,'%s','%s')");
				CString strSQL;

				CTime CurTime = CTime::GetCurrentTime();
				CString strTimeData = CurTime.Format(_T("%Y년 %m월 %d일 - %H시 %M분"));

				strSQL.Format(strFormat , itr->first , m_nLastRevNo , strTimeData , strDesc);
				adoDB.ExecuteQuery(strSQL.operator LPCTSTR());

				strSQL = _T("SELECT * FROM T_PRODUCT_REVISION WHERE C_PRODUCT_NAME = '") + itr->first + _T("' ORDER BY C_REVISION_NO DESC");
				adoDB.OpenQuery(strSQL.operator LPCTSTR());
				LONG lRecordCount = 0L;
				adoDB.GetRecordCount(&lRecordCount);

				CFile f(itr->second , CFile::modeRead);
				ULONGLONG fSize = f.GetLength();
				if(NULL == pData) pData = (char*)calloc(1 , sizeof(char)*fSize);
				if(pData)
				{
					f.Read(pData,fSize);
					const int nFieldCount = adoDB.GetFieldCount();
					for(int i = 0;i < nFieldCount;++i)
					{
						if(_T("C_DATA") == adoDB.GetFieldName(i))
						{
							adoDB.AppendChunk(0 , i , pData , fSize);
							break;
						}
					}
					free((void*)pData);
					pData = NULL;
				}
			}
		}
	}
	else
	{
		AfxMessageBox(_T("Fail to connect database"));
	}
	
	OnOK();
}
void CDBManagePageFake::OnBnClickedButtonOpendatapackageFake()
{
	// TODO: 在此添加控件通知处理程序代码
	BROWSEINFO bi;
	char Buffer[MAX_PATH];
	//CString m_DatasetFoldPath ;//将路径保存在一个CString对象里
	bi.hwndOwner = this->m_hWnd;
	bi.pidlRoot =NULL;//初始化制定的root目录很不容易
	bi.pszDisplayName =(LPWSTR)Buffer;//此参数如为NULL则不能显示对话框
	bi.lpszTitle = L"选择光谱数据集文件夹路径";
	bi.ulFlags =BIF_USENEWUI ; //BIF_EDITBOX;//带编辑框的风格
	bi.lpfn = NULL;
	bi.lParam = 0;
	bi.iImage=IDR_MAINFRAME;
	//初始化入口参数bi结束
	LPITEMIDLIST pIDList = SHBrowseForFolder(&bi);//调用显示选择对话框

	if(pIDList==NULL)
	{	
		return;
	}
	SHGetPathFromIDList(pIDList,(LPWSTR)Buffer);
	//取得文件夹路径到Buffer里
	m_SpecDataFoldPath.Format(L"%s",Buffer);
	// free memory used      
	IMalloc * imalloc = 0;
	if (SUCCEEDED(SHGetMalloc(&imalloc)))
	{
		imalloc->Free (pIDList);
		imalloc->Release();
	}
	//从文件夹中导入光谱数据及相关信息
	CString strDir=m_SpecDataFoldPath;
	strDir.Replace(L"\\",L"\\\\");
	strDir += "\\*.*";

	// 遍历得到所有子文件夹名
	CFileFind finder; 
	BOOL bWorking = finder.FindFile(strDir);
	//清空之前导入的数据集
	OnBnClickedButtonClearspectoaddFake();

	while (bWorking)  
	{
		bWorking = finder.FindNextFile();
		CString str=finder.GetFileName();
		if(str.Right(4)==L".CSV"||str.Right(4)==L".csv" &&L"." !=str &&L".." != str)//注意该句需要排除“.”“..”
		{
			CString filename;
			CString fileTitle;
			//CString str=finder.GetFileName();
			m_ary_SpecFilePath.Add(finder.GetFilePath());
			//获取文件名(不包含后缀)  
			//采用CString的Left(int count)截取CString中从左往右数的count个字符  
			//fileName.GetLength()-4中的4表示".csv"四个字符  
			m_ary_SpecFileName.Add(finder.GetFileTitle());//将文件名(不包含后缀)添加到数组中  
		}
		if(str.Right(4)==L".jpg" ||str.Right(4)==L".bmp"||str.Right(4)==L".gif"&&L"." !=str &&L".." != str)
		{
			m_ary_PicturesName.Add(finder.GetFileName());
			m_ary_PicturesPath.Add(finder.GetFilePath());
		}
		if(str==L"数据说明.xls"||str==L"数据说明.xlsx"&&L"." !=str &&L".." != str)m_ExcelInfoPath=finder.GetFilePath();
	}
	finder.Close();
	if(m_ary_SpecFileName.GetCount()==0)
	{
		MessageBox(L"该文件夹中没有规定格式的光谱数据,请重新选择!",L"警告",MB_ICONWARNING);
		return;
	}
	if(m_ary_SpecFileName.GetCount()<20)
	{
		MessageBox(L"光谱数量太少",L"警告",MB_ICONWARNING);
		return;
	}
	if(!m_ExcelInfoPath.IsEmpty())
	{
		CString strDirExcel=m_ExcelInfoPath;
		CExcelOperator ExcelOperator;
		ExcelOperator.LoadExcel(strDirExcel);
		ExcelOperator.GetItem(1,1,L"String",m_WineName);
		ExcelOperator.ReleaseExcel();
	}
	m_PicIndex=0;
	CString Winename;
	CString Wineinfo=L"";
	CString Comfrom;
	CString ReceiveDate;
	CString Wineinfotemp;

	SortCArrayByFirst(m_ary_SpecFileName,m_ary_SpecFilePath);

	for(int i=0;i<m_ary_SpecFileName.GetCount();i++)
	{
		CString NuMber;
		NuMber.Format(L"%d",i+1);
		m_ListSpectrumToAdd.InsertItem(i,NuMber);
		m_ListSpectrumToAdd.SetItemText(i,1,m_ary_SpecFileName[i]);
		m_ListSpectrumToAdd.SetItemText(i,2,m_WineName);
	}
	OnPaint();


}
Exemple #21
0
BOOL CDeskTopDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	HWND hProgMan = ::FindWindow(L"ProgMan", NULL);
	
	if(hProgMan)
	{
		HWND hShellDefView = ::FindWindowEx(hProgMan, NULL, L"SHELLDLL_DefView", NULL);
		if(hShellDefView)
			m_hWndDesktop = ::FindWindowEx(hShellDefView, NULL, L"SysListView32", NULL);
	}

	::SetParent(m_hWnd,m_hWndDesktop);

	MoveWindow(0,0,GetSystemMetrics ( SM_CXSCREEN )	,GetSystemMetrics ( SM_CYSCREEN ));

	m_DeskIconManager.SetShowWnd(m_hWnd);


	CFileFind finder; 
	CString strPath; 
	BOOL bWorking = finder.FindFile(L"C:\\Users\\GaoZan\\Desktop\\*.*"); 
	while(bWorking) 
	{
		bWorking = finder.FindNextFile(); 

		strPath = finder.GetFilePath(); 
		OutputDebugStringW(strPath+L"\n");
		if(finder.IsDirectory() && !finder.IsDots()) 
		{
			int a=0;
		}
		else if(!finder.IsDirectory() && !finder.IsDots()) 
		{
			CString strIconText;
			strIconText = finder.GetFileTitle();

			CString strNotePadPath(strPath);
			SHFILEINFO stFileInfo;
			:: SHGetFileInfo( strNotePadPath,0,&stFileInfo,sizeof(stFileInfo),SHGFI_ICON);
			HICON hIcon = GetFileIcon(strPath);
			m_DeskIconManager.AddIcon(strIconText,/*stFileInfo.hIcon*/hIcon,strPath);
		}
	} 

	bWorking = finder.FindFile(L"C:\\Users\\Public\\Desktop\\*.*"); 
	while(bWorking) 
	{
		bWorking = finder.FindNextFile(); 

		strPath = finder.GetFilePath(); 
		OutputDebugStringW(strPath+L"\n");
		if(finder.IsDirectory() && !finder.IsDots()) 
		{
			int a=0;
		}
		else if(!finder.IsDirectory() && !finder.IsDots()) 
		{
			CString strIconText;
			strIconText = finder.GetFileTitle();

			CString strNotePadPath(strPath);
			SHFILEINFO stFileInfo;
			:: SHGetFileInfo( strNotePadPath,0,&stFileInfo,sizeof(stFileInfo),SHGFI_ICON);
			HICON hIcon = GetFileIcon(strPath);
			m_DeskIconManager.AddIcon(strIconText,/*stFileInfo.hIcon*/hIcon,strPath);
		}
	} 


// 	for (int i=0;i<10;i++)
// 	{
// 		CString strIconText;
// 		strIconText.Format(L"图标_%d",i);
// 
// 		CString strNotePadPath("C:\\Users\\GaoZan\\Desktop\\ADSafe.lnk");
// 		SHFILEINFO stFileInfo;
// 		:: SHGetFileInfo( strNotePadPath,0,&stFileInfo,sizeof(stFileInfo),SHGFI_ICON);
// 
// 		m_DeskIconManager.AddIcon(strIconText,stFileInfo.hIcon);
// 	}

	return TRUE;  // 除非将焦点设置到控件,否则返回 TRUE
}
Exemple #22
0
BOOL CLanguagesDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();

	NewGUI_TranslateCWnd(this);
	EnumChildWindows(this->m_hWnd, NewGUI_TranslateWindowCb, 0);
	
	NewGUI_XPButton(m_btClose, IDB_CANCEL, IDB_CANCEL);
	NewGUI_XPButton(m_btGetLang, IDB_LANGUAGE, IDB_LANGUAGE);

	NewGUI_ConfigSideBanner(&m_banner, this);
	m_banner.SetIcon(AfxGetApp()->LoadIcon(IDI_WORLD),
		KCSB_ICON_LEFT | KCSB_ICON_VCENTER);
	m_banner.SetTitle(TRL("Load a Language File"));
	m_banner.SetCaption(TRL("Select one of the languages in the list below."));

	RECT rcList;
	m_listLang.GetWindowRect(&rcList);
	const int nColSize = (rcList.right - rcList.left - GetSystemMetrics(SM_CXVSCROLL) - 8) / 4;
	m_listLang.InsertColumn(0, TRL("Available Languages"), LVCFMT_LEFT, nColSize, 0);
	m_listLang.InsertColumn(1, TRL("Language File Version"), LVCFMT_LEFT, nColSize, 1);
	m_listLang.InsertColumn(2, TRL("Author"), LVCFMT_LEFT, nColSize, 2);
	m_listLang.InsertColumn(3, TRL("Translation Author Contact"), LVCFMT_LEFT, nColSize, 3);

	// m_ilIcons.Create(CPwSafeApp::GetClientIconsResourceID(), 16, 1, RGB(255,0,255));
	CPwSafeApp::CreateHiColorImageList(&m_ilIcons, IDB_CLIENTICONS_EX, 16);
	m_listLang.SetImageList(&m_ilIcons, LVSIL_SMALL);

	m_listLang.PostMessage(LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_SI_REPORT |
		LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_ONECLICKACTIVATE |
		LVS_EX_UNDERLINEHOT | LVS_EX_INFOTIP);

	m_listLang.DeleteAllItems();

	LV_ITEM lvi;
	ZeroMemory(&lvi, sizeof(LV_ITEM));
	lvi.iItem = m_listLang.InsertItem(LVIF_TEXT | LVIF_IMAGE, m_listLang.GetItemCount(),
		_T("English"), 0, 0, 1, NULL);

	CString strTemp;
	
	strTemp = PWM_VERSION_STR;
	lvi.iSubItem = 1; lvi.mask = LVIF_TEXT;
	lvi.pszText = (LPTSTR)(LPCTSTR)strTemp;
	m_listLang.SetItem(&lvi);

	strTemp = PWMX_ENGLISH_AUTHOR;
	lvi.iSubItem = 2; lvi.mask = LVIF_TEXT;
	lvi.pszText = (LPTSTR)(LPCTSTR)strTemp;
	m_listLang.SetItem(&lvi);

	strTemp = PWMX_ENGLISH_CONTACT;
	lvi.iSubItem = 3; lvi.mask = LVIF_TEXT;
	lvi.pszText = (LPTSTR)(LPCTSTR)strTemp;
	m_listLang.SetItem(&lvi);

	CFileFind ff;
	CString csTmp;
	BOOL chk_w = FALSE;
	TCHAR szCurrentlyLoaded[MAX_PATH * 2];

	_tcscpy_s(szCurrentlyLoaded, _countof(szCurrentlyLoaded), GetCurrentTranslationTable());

	std_string strFilter = Executable::instance().getPathOnly();
	strFilter += _T("*.lng");

	chk_w = ff.FindFile(strFilter.c_str(), 0);
	while(chk_w == TRUE)
	{
		chk_w = ff.FindNextFile();

		csTmp = ff.GetFileTitle();
		csTmp = csTmp.MakeLower();
		if((csTmp != _T("standard")) && (csTmp != _T("english")))
		{
			VERIFY(LoadTranslationTable((LPCTSTR)ff.GetFileTitle()));

			strTemp = (LPCTSTR)ff.GetFileTitle();
			// strTemp += _T(" - ");
			// strTemp += TRL("~LANGUAGENAME");

			lvi.iItem = m_listLang.InsertItem(LVIF_TEXT | LVIF_IMAGE,
				m_listLang.GetItemCount(), strTemp, 0, 0, 1, NULL);

			strTemp = TRL("~LANGUAGEVERSION");
			if(strTemp == _T("~LANGUAGEVERSION")) strTemp.Empty();
			lvi.iSubItem = 1; lvi.mask = LVIF_TEXT;
			lvi.pszText = (LPTSTR)(LPCTSTR)strTemp;
			m_listLang.SetItem(&lvi);

			strTemp = TRL("~LANGUAGEAUTHOR");
			if(strTemp == _T("~LANGUAGEAUTHOR")) strTemp.Empty();
			lvi.iSubItem = 2; lvi.mask = LVIF_TEXT;
			lvi.pszText = (LPTSTR)(LPCTSTR)strTemp;
			m_listLang.SetItem(&lvi);

			strTemp = TRL("~LANGUAGEAUTHOREMAIL");
			if(strTemp == _T("~LANGUAGEAUTHOREMAIL")) strTemp.Empty();
			lvi.iSubItem = 3; lvi.mask = LVIF_TEXT;
			lvi.pszText = (LPTSTR)(LPCTSTR)strTemp;
			m_listLang.SetItem(&lvi);
		}
	}

	ff.Close();

	VERIFY(LoadTranslationTable(szCurrentlyLoaded));
	return TRUE;
}
void CDBManageTrueDlg::OnBnClickedButtonOpendatapackageTrue()
{
	// TODO: 在此添加控件通知处理程序代码
	BROWSEINFO bi;
	char Buffer[MAX_PATH];
	//CString m_DatasetFoldPath ;//将路径保存在一个CString对象里
	bi.hwndOwner = this->m_hWnd;
	bi.pidlRoot =NULL;//初始化制定的root目录很不容易
	bi.pszDisplayName =(LPWSTR)Buffer;//此参数如为NULL则不能显示对话框
	bi.lpszTitle = L"选择光谱数据集文件夹路径";
	bi.ulFlags =BIF_USENEWUI ; //BIF_EDITBOX;//带编辑框的风格
	bi.lpfn = NULL;
	bi.lParam = 0;
	bi.iImage=IDR_MAINFRAME;
	//初始化入口参数bi结束
	LPITEMIDLIST pIDList = SHBrowseForFolder(&bi);//调用显示选择对话框

	if(pIDList==NULL)
	{	
		return;
	}
	SHGetPathFromIDList(pIDList,(LPWSTR)Buffer);
	//取得文件夹路径到Buffer里
	m_SpecDataFoldPath.Format(L"%s",Buffer);
	// free memory used      
	IMalloc * imalloc = 0;
	if (SUCCEEDED(SHGetMalloc(&imalloc)))
	{
		imalloc->Free (pIDList);
		imalloc->Release();
	}
	//从文件夹中导入光谱数据及相关信息
	CString strDir=m_SpecDataFoldPath;
	strDir.Replace(L"\\",L"\\\\");
	strDir += "\\*.*";

	// 遍历得到所有子文件夹名
	CFileFind finder; 
	BOOL bWorking = finder.FindFile(strDir);

	/*m_ary_PicturesPath.RemoveAll();
	m_ary_SpecFileName.RemoveAll();
	m_ary_SpecFilePath.RemoveAll();
	m_ListSpectrumToAdd.DeleteAllItems();
	//m_ary_ProjectPathNew.RemoveAll();*/
	while (bWorking)  
	{
		bWorking = finder.FindNextFile();
		CString str=finder.GetFileName();
		if(str.Right(4)==L".CSV"||str.Right(4)==L".csv" &&L"." !=str &&L".." != str)//注意该句需要排除“.”“..”
		{
			CString filename;
			CString fileTitle;
			//CString str=finder.GetFileName();
			m_ary_SpecFilePath.Add(finder.GetFilePath());
			//获取文件名(不包含后缀)  
			//采用CString的Left(int count)截取CString中从左往右数的count个字符  
			//fileName.GetLength()-4中的4表示".csv"四个字符  
			m_ary_SpecFileName.Add(finder.GetFileTitle());//将文件名(不包含后缀)添加到数组中  
		}
		if(str.Right(4)==L".jpg" ||str.Right(4)==L".bmp"||str.Right(4)==L".gif"&&L"." !=str &&L".." != str)m_ary_PicturesPath.Add(finder.GetFilePath());
		if(str==L"数据说明.xls"||str==L"数据说明.xlsx"&&L"." !=str &&L".." != str)m_ExcelInfoPath=finder.GetFilePath();
	}
	finder.Close();
	if(m_ary_SpecFileName.GetCount()==0)
	{
		MessageBox(L"该文件夹中没有规定格式的光谱数据,请重新选择!",L"警告",MB_ICONWARNING);
		return;
	}
	if(m_ary_SpecFileName.GetCount()<30)
	{
		MessageBox(L"光谱数量太少",L"警告",MB_ICONWARNING);
	}
	m_PicIndex=0;
	CString Winename;
	CString Wineinfo=L"";
	CString Comfrom;
	CString ReceiveDate;
	CString Wineinfotemp;
	if(m_ExcelInfoPath.IsEmpty())
	{
		if(IDOK==MessageBox(L"数据包中缺少必要的光谱说明文件,是否自行填写?",L"信息缺失",MB_OKCANCEL|MB_ICONQUESTION))
		{
			CInputSpecDatasetInfoDlg InputSpecDatasetInfoDlg;
			if(IDOK==InputSpecDatasetInfoDlg.DoModal())
			{
				m_WineName=InputSpecDatasetInfoDlg.m_WineName;
				m_AlcoholContent=InputSpecDatasetInfoDlg.m_AlcoholContent;
				Wineinfo=m_AlcoholContent+L"度,";
				m_Flavour=InputSpecDatasetInfoDlg.m_Flavour;
				Wineinfo+=m_Flavour;
				Wineinfo+=L",";
				m_Brand=InputSpecDatasetInfoDlg.m_Brand;
				Wineinfo+=m_Brand;
				m_Comfrom=L"管理员";
				SYSTEMTIME tm;		
				GetDirTime(m_SpecDataFoldPath,tm);			
				ReceiveDate.Format(L"%d-%d-%d",tm.wYear,tm.wMonth,tm.wDay);			
			}
			else
			{
				m_ary_SpecFilePath.RemoveAll();
				m_ary_SpecFileName.RemoveAll();
				m_ary_PicturesPath.RemoveAll();
				return;
			}
		}
		else
		{
			m_ary_SpecFilePath.RemoveAll();
			m_ary_SpecFileName.RemoveAll();
			m_ary_PicturesPath.RemoveAll();
			return;
		}

	}
	else
	{
		CString strDirExcel=m_ExcelInfoPath;
		//strDirExcel.Replace(L"\\",L"\\\\");
		CExcelOperator ExcelOperator;
		ExcelOperator.LoadExcel(strDirExcel);

		ExcelOperator.GetItem(1,1,L"String",m_WineName);


		ExcelOperator.GetItem(2,1,L"int",m_AlcoholContent);
		Wineinfo+=m_AlcoholContent;
		Wineinfo+=L"度,";
		ExcelOperator.GetItem(3,1,L"String",m_Flavour);
		Wineinfo+=m_Flavour;
		Wineinfo+=L",";
		ExcelOperator.GetItem(4,1,L"String",m_Brand);
		Wineinfo+=m_Brand;

		ExcelOperator.GetItem(5,1,L"Date",m_ProductionDate);
		//Wineinfo+=Wineinfotemp;

		ExcelOperator.GetItem(6,1,L"String",m_BatchNo);
		//Wineinfo+=Wineinfotemp;

		ExcelOperator.GetItem(7,1,L"String",m_Comfrom);
		ExcelOperator.GetItem(8,1,L"Date",ReceiveDate);

		ExcelOperator.ReleaseExcel();
	}


	SortCArrayByFirst(m_ary_SpecFileName,m_ary_SpecFilePath);

	for(int i=0;i<m_ary_SpecFileName.GetCount();i++)
	{
		//CString Current=m_ary_SpecFilePath[i];

		m_ListSpectrumToAdd.InsertItem(i,m_ary_SpecFileName[i]);
		m_ListSpectrumToAdd.SetItemText(i,1,m_WineName);
		m_ListSpectrumToAdd.SetItemText(i,2,Wineinfo);
		m_ListSpectrumToAdd.SetItemText(i,3,m_ProductionDate);
		m_ListSpectrumToAdd.SetItemText(i,4,m_BatchNo);
		m_ListSpectrumToAdd.SetItemText(i,5,m_Comfrom);
		m_ListSpectrumToAdd.SetItemText(i,6,ReceiveDate);
	}

}
Exemple #24
0
bool DeviceProxy::SendCashDataProc()
{
	if (!m_sendCash.IsOpened())
		return false;

	m_sendCash.SetTimeout(8000);

	CashInfo cashInfo;
	CString fileName;
	CString filePath;
	CFileFind ff;
	CString dataDir = ConfigBlock::GetInstance()->GetStringParameter(L"RunCashPara", L"dataPath", L"");;
	if (dataDir.Right(1) != "\\")
		dataDir += "\\";
	dataDir += "*.raw";

	//CString date, time, title, side;

	bool ret = ff.FindFile(dataDir);
	SendStartRunCashSignal();
	while (ret)
	{
		ret = ff.FindNextFile();

		if (ff.IsDirectory())
			continue;
		if (!(fileName = ff.GetFileTitle()))
			continue;

		// 解析文件名
		int index = 0;
		CString temp = L"";
		for (int i = 0;; i++)
		{
			if (fileName[i] != '_'&&i < fileName.GetLength())
				temp += fileName[i];
			else if (fileName[i] == '_' || i == fileName.GetLength())
			{
				index++;
				switch (index)
				{
					//case 1:
					//date = temp;
					//break;
					//case 2:
					//time = temp;
					//break;
				case 3:
					swscanf_s(temp, _T("%d"), &(cashInfo.count));
					break;
				case 4:
					//error = temp;
					swscanf_s(temp.Mid(3), _T("%d"), &(cashInfo.error));
					break;
				case 5:
					//lasterr = temp;
					break;
				case 6:
					//den = temp;
					swscanf_s(temp.Mid(3), _T("%d"), &(cashInfo.denomination));
					break;
				case 7:
					//dir = temp;
					swscanf_s(temp.Mid(3), _T("%d"), &(cashInfo.direction));
					break;
				case 8:
					//ver = temp;
					swscanf_s(temp.Mid(3), _T("%d"), &(cashInfo.version));
					break;
				case 9:
					//sn = temp;
					WideCharToMultiByte(CP_ACP, 0, temp, -1, cashInfo.sn, WideCharToMultiByte(CP_ACP, 0, temp, -1, NULL, 0, NULL, NULL), NULL, NULL);
					break;
					//case 10:
					//	title = temp;
					//	break;
					//case 11:
					//	side = temp;
					//	break;
				default:
					break;
				}
				temp = L"";
				if (index == 9)
					break;
				if (i == fileName.GetLength())
					break;
			}
		}

		m_cashCnt++;

		filePath = ff.GetFilePath();
		SendADCData(filePath);

		filePath = filePath.Left(filePath.Find(_T("adc")));
		filePath += "cis_top.bmp";
		SendCISData(filePath);

		SendCashInfo(cashInfo);
	}
	SendStopRunCashSignal();
	PostMessage(AfxGetApp()->GetMainWnd()->GetSafeHwnd(), WM_RUN_CASH_STOPPED, 0, 1);
}
int CPlugins::Load( LPCTSTR lpstrPath)
{
	CString	csPath;
	int		nPlugin = 0,
			nCount = 0;
	BOOL	bFoundPlugins = FALSE,
			bValidPlugin;

	try
	{
		CFileFind			cFinder;

		// plugin struct array initialization
		for (int i=0; i<MAX_PLUGINS; i++ )
		{
			m_plugin[i].hDll		= NULL;
			m_plugin[i].pInventory	= NULL;
			m_plugin[i].pPrologResp	= NULL;
			m_plugin[i].pPrologWrite= NULL;
			m_plugin[i].pStart		= NULL;
			m_plugin[i].pEnd		= NULL;
			m_plugin[i].pClean		= NULL;
		}
		if ((lpstrPath == NULL) || (_tcslen( lpstrPath) == 0))
			// Use standard install path
			csPath.Format( _T( "%s\\plugins"), getInstallFolder());
		else
			// Use provided path to search for plugins
			csPath = lpstrPath;
		// Search for DLL into path
		m_pLogger->log( LOG_PRIORITY_DEBUG,  _T( "DLL PLUGIN => Searching for Plug-in DLL(s) in folder <%s>"), csPath);
		csPath +=  _T( "\\*.dll");
		bFoundPlugins = cFinder.FindFile( csPath);
		while (bFoundPlugins)
		{
			bValidPlugin = FALSE;
			// One DLL found, try to load it
			bFoundPlugins = cFinder.FindNextFile();
			m_pLogger->log(LOG_PRIORITY_DEBUG,  _T( "DLL PLUGIN => Trying to validate DLL <%s> as a Plug-in"), cFinder.GetFileName());
			if( (m_plugin[nPlugin].hDll = LoadLibrary( cFinder.GetFilePath())) == NULL )
			{
				m_pLogger->log( LOG_PRIORITY_WARNING,  _T( "DLL PLUGIN => Failed loading Plug-in DLL <%s>, %s"), cFinder.GetFileName(), LookupError( GetLastError()));
				continue;
			}
			// Get name
			m_plugin[nPlugin].csName = cFinder.GetFileTitle();
			// Try to load each API entry
			if( (m_plugin[nPlugin].pEnd = (HOOK_END)GetProcAddress( m_plugin[nPlugin].hDll, "OCS_CALL_END_EXPORTED")) == NULL)
			{
				m_pLogger->log( LOG_PRIORITY_WARNING,  _T( "DLL PLUGIN => No End hook for Plug-in <%s>, %s"), cFinder.GetFileTitle(), LookupError( GetLastError()));
			}
			else
				// Hook available, so valid plugin
				bValidPlugin = TRUE;
			if( (m_plugin[nPlugin].pStart = (HOOK_START)GetProcAddress( m_plugin[nPlugin].hDll, "OCS_CALL_START_EXPORTED")) == NULL)
			{
				m_pLogger->log( LOG_PRIORITY_WARNING,  _T( "DLL PLUGIN => No Start hook for Plug-in <%s>, %s"), cFinder.GetFileTitle(), LookupError( GetLastError()));
			}
			else
				// Hook available, so valid plugin
				bValidPlugin = TRUE;
			if( (m_plugin[nPlugin].pClean = (HOOK_CLEAN)GetProcAddress( m_plugin[nPlugin].hDll, "OCS_CALL_CLEAN_EXPORTED")) == NULL)
			{
				m_pLogger->log( LOG_PRIORITY_WARNING,  _T( "DLL PLUGIN => No Clean hook for Plug-in <%s>, %s"), cFinder.GetFileTitle(), LookupError( GetLastError()));
			}
			else
				// Hook available, so valid plugin
				bValidPlugin = TRUE;
			if( (m_plugin[nPlugin].pInventory = (HOOK_INVENTORY)GetProcAddress( m_plugin[nPlugin].hDll, "OCS_CALL_INVENTORY_EXPORTED")) == NULL)
			{
				m_pLogger->log( LOG_PRIORITY_WARNING,  _T( "DLL PLUGIN => No Inventory hook for Plug-in <%s>, %s"), cFinder.GetFileTitle(), LookupError( GetLastError()));
			}
			else
				// Hook available, so valid plugin
				bValidPlugin = TRUE;
			if( (m_plugin[nPlugin].pPrologWrite = (HOOK_PROLOG_WRITE)GetProcAddress( m_plugin[nPlugin].hDll, "OCS_CALL_PROLOGWRITE_EXPORTED")) == NULL)
			{
				m_pLogger->log( LOG_PRIORITY_WARNING,  _T( "DLL PLUGIN => No Prolog Read hook for Plug-in <%s>, %s"), cFinder.GetFileTitle(), LookupError( GetLastError()));
			}
			else
				// Hook available, so valid plugin
				bValidPlugin = TRUE;
			if( (m_plugin[nPlugin].pPrologResp = (HOOK_PROLOG_RESP)GetProcAddress( m_plugin[nPlugin].hDll, "OCS_CALL_PROLOGRESP_EXPORTED")) == NULL)
			{
				m_pLogger->log( LOG_PRIORITY_WARNING,  _T( "DLL PLUGIN => No Prolog response hook for Plug-in <%s>, %s"), cFinder.GetFileTitle(), LookupError( GetLastError()));
			}
			else
				// Hook available, so valid plugin
				bValidPlugin = TRUE;
			if (bValidPlugin)
			{
				// At least one hook available and plugin valid
				m_pLogger->log( LOG_PRIORITY_NOTICE,  _T( "DLL PLUGIN => Plug-in <%s> loaded"), m_plugin[nPlugin].csName);
				// Store and increase plugin number
				nPlugin++;
			}
			else
			{
				// Do not store DLL as a plugin
				m_pLogger->log(LOG_PRIORITY_DEBUG,  _T( "DLL PLUGIN => DLL <%s> is not a valid Plug-in"), cFinder.GetFileName());
				FreeLibrary( m_plugin[nPlugin].hDll );
			}
			nCount++;
		}
		cFinder.Close();
		m_pLogger->log(LOG_PRIORITY_DEBUG,  _T( "DLL PLUGIN => %d DLL Plug-in(s) succesfully loaded on %d DLL(s) found"), nPlugin, nCount);
		return nPlugin;
	}
	catch (CException *pEx)
	{
		m_pLogger->log( LOG_PRIORITY_WARNING,  _T( "DLL PLUGIN => Error while parsing Plug-in directory <%s>"), LookupError( pEx));
		pEx->Delete();
		return -1;
	}
}
Exemple #26
0
BOOL CDlgNote::OnInitDialog()
{
	CDialogEx::OnInitDialog();

	// TODO:  在此添加额外的初始化
///SetWindowPos(NULL, 0+1, CAPTIONHEIGHT+TOOLHEIGHT+1, MINSIZEX-2, MINSIZEY-(CAPTIONHEIGHT+TOOLHEIGHT)-2, NULL);//left top width height
	SetWindowPos(NULL, 0+1, CAPTIONHEIGHT+TOOLHEIGHT+1, MINSIZEX-2, MINSIZEY-(CAPTIONHEIGHT+TOOLHEIGHT)-2, NULL);
	//SetBackgroundColor(RGB(45,62,92),TRUE);
	SetBackgroundColor(RGB(105,161,191),TRUE);
	m_List_ctlTitle.SetBkColor(LISTCONTROLBACKGROUNDCOLOR);
	m_List_ctlTitle.SetRowHeigt(25);               //设置行高度
	m_List_ctlTitle.SetHeaderHeight(1);          //设置头部高度
	m_List_ctlTitle.SetHeaderFontHW(12,0);         //设置头部字体高度,和宽度,0表示缺省,自适应 
	m_List_ctlTitle.SetHeaderTextColor(RGB(105,161,191)); //设置头部字体颜色

	m_List_ctlTitle.SetHeaderBKColor(76,85,89,1); //设置头部背景色 
	m_List_ctlTitle.SetFontHW(12,0);               //设置字体高度,和宽度,0表示缺省宽度
	m_List_ctlTitle.SetColTextColor(0,RGB(255,255,255)); //设置列文本颜色

	m_List_ctlTitle.InsertColumn(0,_T("备忘标题"),LVCFMT_LEFT,80);
	m_List_ctlTitle.InsertColumn(1,_T("文件路径"),LVCFMT_LEFT,0);


	m_List_ctlTitle.MoveWindow(1,0,168,550+27);
	CRect rcClient;
	m_List_ctlTitle.GetClientRect(&rcClient);
	m_List_ctlTitle.SetColumnWidth(0,rcClient.Width());




	m_Button_ctlNew.LoadStdImage(IDB_PNG_NEW, _T("PNG"));
	m_Button_ctlNew.MoveWindow(169,1,63,24,TRUE);//62,23




	




	m_Button_ctlSave.LoadStdImage(IDB_PNG_NOTESAVE, _T("PNG"));
	m_Button_ctlSave.MoveWindow(MINSIZEX-63*2-5-20,1,63,24,TRUE);

	m_Button_ctlCancel.LoadStdImage(IDB_PNG_NOTEDEL, _T("PNG"));
	m_Button_ctlCancel.MoveWindow(MINSIZEX-63-20,1,63,24,TRUE);

	
//	CRect rcClient;
	m_List_ctlTitle.GetClientRect(&rcClient);
	m_List_ctlTitle.SetColumnWidth(0,rcClient.Width());
	m_Edit_ctlTitle.MoveWindow(168,25,MINSIZEX-2-168,25);
	m_Edit_ctlContent.MoveWindow(168,51,MINSIZEX-2-168,MINSIZEY-(CAPTIONHEIGHT+TOOLHEIGHT)-2-23-2-25-4);



	int i=0;
	CFileFind finder;

	CString strPath;
	CString strFileName;


	CString strSavePath;
	strSavePath=CBoBoDingApp::g_strNotePath+_T("*.txt");


		BOOL bWorking = finder.FindFile(strSavePath);
	while (bWorking)

	{

		bWorking = finder.FindNextFile();

		strPath=finder.GetFilePath();
		strFileName=finder.GetFileTitle();
		//strPath就是所要获取Test目录下的文件夹和文件(包括路径)
		m_List_ctlTitle.InsertItem(i,strFileName,LVCFMT_LEFT);
		m_List_ctlTitle.SetItemText(i,1,strPath);

		i++;

	}





	m_Font.CreatePointFont(105, _T("宋体"));



	m_Edit_ctlTitle.SetFont(&m_Font);
	m_Edit_ctlContent.SetFont(&m_Font);



	m_List_ctlTitle.EnableScrollBar(SB_HORZ, ESB_DISABLE_BOTH);
	/******************************************************************************/

	//m_Button_ctlSave.EnableButton(FALSE);
	//m_Button_ctlCancel.EnableButton(FALSE);


	return TRUE;  // return TRUE unless you set the focus to a control

	// 异常: OCX 属性页应返回 FALSE
}
Exemple #27
0
// 初始化
BOOL CSettingDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	HICON hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
	SetIcon(hIcon, TRUE);			// 设置大图标
	SetIcon(hIcon, FALSE);			// 设置小图标

	// 初始化m_tab
	int i = 0;
	m_tab.InsertItem(i++, _T("首选项"));
	m_tab.InsertItem(i++, _T("违规内容"));
	m_tab.InsertItem(i++, _T("违规图片"));
	m_tab.InsertItem(i++, _T("屏蔽用户"));
	m_tab.InsertItem(i++, _T("信任用户"));
	m_tab.InsertItem(i++, _T("信任内容"));
	m_tab.InsertItem(i++, _T("方案"));
	m_tab.InsertItem(i++, _T("账号管理"));
	m_tab.InsertItem(i++, _T("关于&&更新"));

	// 初始化各页
	m_prefPage.Create(IDD_PREF_PAGE, &m_tab);
	m_keywordsPage.Create(IDD_LIST_PAGE, &m_tab);
	m_imagePage.Create(IDD_IMAGE_PAGE, &m_tab);
	m_blackListPage.Create(IDD_LIST_PAGE, &m_tab);
	m_whiteListPage.Create(IDD_LIST_PAGE, &m_tab);
	m_whiteContentPage.Create(IDD_LIST_PAGE, &m_tab);
	m_optionsPage.Create(IDD_OPTIONS_PAGE, &m_tab);
	m_usersPage.Create(IDD_USERS_PAGE, &m_tab);
	m_aboutPage.Create(IDD_ABOUT_PAGE, &m_tab);

	CRect rect;
	m_tab.GetClientRect(&rect);
	rect.left += 1; rect.right -= 3; rect.top += 23; rect.bottom -= 2;
	m_pages[0]->SetWindowPos(NULL, rect.left, rect.top, rect.Width(), rect.Height(), SWP_SHOWWINDOW);
	for (i = 1; i < _countof(m_pages); i++)
		m_pages[i]->SetWindowPos(NULL, rect.left, rect.top, rect.Width(), rect.Height(), SWP_HIDEWINDOW);

	// 显示配置
	ShowCurrentOptions();
	m_clearScanCache = FALSE; // 在m_prefPage.m_scanPageCountEdit.SetWindowText后初始化

	m_optionsPage.m_currentOptionStatic.SetWindowText(_T("当前方案:") + g_currentOption); // 当前方案
	// 方案
	CFileFind fileFind;
	BOOL flag = fileFind.FindFile(OPTIONS_PATH + _T("*.tb"));
	while (flag)
	{
		flag = fileFind.FindNextFile();
		m_optionsPage.m_list.AddString(fileFind.GetFileTitle());
	}

	m_usersPage.m_currentUserStatic.SetWindowText(_T("当前账号:") + g_currentUser); // 当前账号
	// 账号
	m_usersPage.m_list.AddString(_T("[NULL]"));
	flag = fileFind.FindFile(USERS_PATH + _T("*"));
	while (flag)
	{
		flag = fileFind.FindNextFile();
		if (fileFind.IsDirectory() && !fileFind.IsDots() && PathFileExists(fileFind.GetFilePath() + _T("\\ck.tb")))
		{
			CString name = fileFind.GetFileName();
			if (name != _T("[NULL]"))
				m_usersPage.m_list.AddString(name);
		}
	}

	m_aboutPage.m_autoCheckUpdateCheck.SetCheck(g_autoUpdate); // 自动更新

	return TRUE;  // return TRUE unless you set the focus to a control
	// 异常:  OCX 属性页应返回 FALSE
}
Exemple #28
0
BOOL CVoiceSetup::OnInitDialog(void)
{
	
	CDialog::OnInitDialog();
	
	HRESULT                             hr = S_OK;

	/*hr = SpEnumTokens(SPCAT_VOICES, NULL, NULL, &cpEnum);
	
	if(SUCCEEDED(hr)){

		hr = cpEnum->GetCount(&ulCount);

	}

	while(SUCCEEDED(hr) && ulCount -- ){
    
		cpVoiceToken.Release();
		if(SUCCEEDED(hr))
			hr = cpEnum->Next( 1, &cpVoiceToken, NULL );
		if(SUCCEEDED(hr))
	        hr = cpVoice->SetVoice(cpVoiceToken);
	    if(SUCCEEDED(hr))
			hr = cpVoice->Speak( L"How are you?", SPF_DEFAULT, NULL);

		m_cbMaleVoice.AddString(
	}  */


	hr = SpInitTokenComboBox(GetDlgItem(IDC_MALE_VOICE)->m_hWnd, SPCAT_VOICES);
	if(FAILED(hr)){

		AfxMessageBox("Error enumerating voices", MB_ICONSTOP);
	}

	hr = SpInitTokenComboBox(GetDlgItem(IDC_FEMALE_VOICE)->m_hWnd, SPCAT_VOICES);
	if(FAILED(hr)){

		AfxMessageBox("Error enumerating voices", MB_ICONSTOP);
	}


	CFileFind finder;

	BOOL bFound = finder.FindFile(g_sSettings.GetWorkingDir() + "\\gfx\\char_*.bmp");
	CString strChar, strTmp;
	while(finder.FindNextFile()){

		strChar = finder.GetFileTitle();
		strChar = strChar.Mid(5);
		m_cbMaleChar.AddString(strChar);
		m_cbFemChar.AddString(strChar);
	}


	CIni ini;
	ini.SetIniFileName(g_sSettings.GetIniFile());

	int nCnt = ini.GetValue("Voice", "MaleCount", 0);
	for(int i = 0; i < nCnt; i++){

		strTmp.Format("Male_%d", i);
		m_lbMales.AddString(ini.GetValue("Voice", strTmp, ""));
	}

	nCnt = ini.GetValue("Voice", "FemaleCount", 0);
	for(int i = 0; i < nCnt; i++){

		strTmp.Format("Female_%d", i);
		m_lbFemales.AddString(ini.GetValue("Voice", strTmp, ""));
	}



	return TRUE;
}
//------------------------------------------------
// 파일의 리스트 및 각 파일에 대한 자세한 정보를 
// 함께 저장하게 됨
// data.h파일에 해당 구조체를 선언한다.
//--------------------------------------------------
void CMyExplorerDoc::SelectTreeViewFolder(CString strFullName)
{

	LIST_VIEW*	pListView;
	CFileFind	ff;

	// 사용자가 폴더를 선택할 때마다 파일 리스트를
	// 새로 업데이트 해야 함
	// 따라서 기존 정보를 모두 삭제한다.
	if (m_pFileList != NULL)
		RemoveAllFileList();

	m_pFileList = new CObList;

	SetCurrentPath(strFullName);
	strFullName += "*.*";

	if (ff.FindFile(strFullName) == TRUE)
	{
		BOOL	bFlag = TRUE;
		while(bFlag == TRUE)
		{
			bFlag = ff.FindNextFile();

			// 디렉토리 , 도트파일이면 다시 찾음 
			if (ff.IsDirectory() || ff.IsDots())
				continue;
			
			// 파일 정보를 알아내서LIST_VIEW 구조체에 
			// 저장한 후 
			// 그것을 모두 m_pFileList에 저장한다.
			pListView = new LIST_VIEW;
			InitListViewStruct(pListView);

			pListView->strName = ff.GetFileName();
			pListView->strPath = ff.GetFilePath();

			CString		strName = pListView->strName;
			CString		strExt = ff.GetFileTitle();

			int			nNum = strName.GetLength() - strExt.GetLength();

			if (nNum == 0)
				strExt = "";
			else
				strExt = strName.Right(nNum - 1);
			pListView->strKind = strExt + " 파일";
			pListView->dwFileSize = ff.GetLength();

			CTime	time;
			if (ff.GetCreationTime(time) == TRUE)
				pListView->tCreateTime = time;
			if (ff.GetLastAccessTime(time) == TRUE)
				pListView->tLastAccessTime = time;
			if (ff.GetLastWriteTime(time) == TRUE)
				pListView->tLastWriteTime = time;
			if (ff.IsHidden() == TRUE)
				pListView->bIsHidden = TRUE;
			if (ff.IsReadOnly() == TRUE)
				pListView->bIsReadOnly = TRUE;
			if (ff.IsArchived() == TRUE)
				pListView->bIsArchived = TRUE;
			if (ff.IsSystem() == TRUE)
				pListView->bIsSystem = TRUE;

			m_pFileList->AddTail((CObject*)pListView);
		}
	}
	ff.Close();

	//------------------------------
	m_pExpListView->SetFileList();
	//-------------------------------------
}
BOOL CLanguagesDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();

	NewGUI_TranslateCWnd(this);
	EnumChildWindows(this->m_hWnd, NewGUI_TranslateWindowCb, 0);
	
	NewGUI_XPButton(m_btClose, IDB_CANCEL, IDB_CANCEL);
	NewGUI_XPButton(m_btGetLang, IDB_LANGUAGE, IDB_LANGUAGE);
	NewGUI_XPButton(m_btOpenFolder, IDB_TB_OPEN, IDB_TB_OPEN);

	NewGUI_ConfigSideBanner(&m_banner, this);
	m_banner.SetIcon(AfxGetApp()->LoadIcon(IDI_WORLD),
		KCSB_ICON_LEFT | KCSB_ICON_VCENTER);
	m_banner.SetTitle(TRL("Select Language"));
	m_banner.SetCaption(TRL("Here you can change the user interface language."));

	RECT rcList;
	m_listLang.GetClientRect(&rcList);
	const int wList = rcList.right - rcList.left - GetSystemMetrics(SM_CXVSCROLL);
	const int w2 = (wList * 2) / 20;
	const int w3 = (wList * 3) / 20;
	const int w5 = (wList * 5) / 20;
	m_listLang.InsertColumn(0, TRL("Installed Languages"), LVCFMT_LEFT, w5, 0);
	m_listLang.InsertColumn(1, TRL("Version"), LVCFMT_LEFT, w2, 1);
	m_listLang.InsertColumn(2, TRL("Author"), LVCFMT_LEFT, w5, 2);
	m_listLang.InsertColumn(3, TRL("Contact"), LVCFMT_LEFT, w5, 3);
	m_listLang.InsertColumn(4, TRL("File"), LVCFMT_LEFT, w3, 4);

	// m_ilIcons.Create(CPwSafeApp::GetClientIconsResourceID(), 16, 1, RGB(255,0,255));
	CPwSafeApp::CreateHiColorImageList(&m_ilIcons, IDB_CLIENTICONS_EX, 16);
	m_listLang.SetImageList(&m_ilIcons, LVSIL_SMALL);

	m_listLang.PostMessage(LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_SI_REPORT |
		LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_ONECLICKACTIVATE |
		LVS_EX_UNDERLINEHOT | LVS_EX_INFOTIP);

	m_listLang.DeleteAllItems();

	LV_ITEM lvi;
	ZeroMemory(&lvi, sizeof(LV_ITEM));
	lvi.iItem = m_listLang.InsertItem(LVIF_TEXT | LVIF_IMAGE, m_listLang.GetItemCount(),
		_T("English"), 0, 0, 1, NULL);

	CString strTemp;
	
	strTemp = PWM_VERSION_STR;
	lvi.iSubItem = 1; lvi.mask = LVIF_TEXT;
	lvi.pszText = (LPTSTR)(LPCTSTR)strTemp;
	m_listLang.SetItem(&lvi);

	strTemp = PWMX_ENGLISH_AUTHOR;
	lvi.iSubItem = 2; lvi.mask = LVIF_TEXT;
	lvi.pszText = (LPTSTR)(LPCTSTR)strTemp;
	m_listLang.SetItem(&lvi);

	strTemp = PWMX_ENGLISH_CONTACT;
	lvi.iSubItem = 3; lvi.mask = LVIF_TEXT;
	lvi.pszText = (LPTSTR)(LPCTSTR)strTemp;
	m_listLang.SetItem(&lvi);

	strTemp = TRL("Built-in");
	lvi.iSubItem = 4; lvi.mask = LVIF_TEXT;
	lvi.pszText = (LPTSTR)(LPCTSTR)strTemp;
	m_listLang.SetItem(&lvi);

	const std_string strActive = GetCurrentTranslationTable();

	std_string strFilter = SU_DriveLetterToUpper(Executable::instance().getPathOnly());
	strFilter += PWM_DIR_LANGUAGES;
	strFilter += _T("\\*.lng");

	CFileFind ff;
	BOOL bMore = ff.FindFile(strFilter.c_str(), 0);
	while(bMore != FALSE)
	{
		bMore = ff.FindNextFile();

		// Ignore KeePass 2.x LNGX files (these are found even though
		// "*.lng" is specified as file mask)
		CString strFileName = ff.GetFileName();
		strFileName = strFileName.MakeLower();
		if((strFileName.GetLength() >= 5) && (strFileName.Right(5) == _T(".lngx")))
			continue;

		CString strID = ff.GetFileTitle();
		strID = strID.MakeLower();
		if((strID != _T("standard")) && (strID != _T("english")))
		{
			VERIFY(LoadTranslationTable((LPCTSTR)ff.GetFileTitle()));

			strTemp = (LPCTSTR)ff.GetFileTitle();
			// strTemp += _T(" - "); // Name is used as identifier
			// strTemp += TRL("~LANGUAGENAME");

			lvi.iItem = m_listLang.InsertItem(LVIF_TEXT | LVIF_IMAGE,
				m_listLang.GetItemCount(), strTemp, 0, 0, 1, NULL);

			strTemp = TRL("~LANGUAGEVERSION");
			if(strTemp == _T("~LANGUAGEVERSION")) strTemp.Empty();
			lvi.iSubItem = 1; lvi.mask = LVIF_TEXT;
			lvi.pszText = (LPTSTR)(LPCTSTR)strTemp;
			m_listLang.SetItem(&lvi);

			strTemp = TRL("~LANGUAGEAUTHOR");
			if(strTemp == _T("~LANGUAGEAUTHOR")) strTemp.Empty();
			lvi.iSubItem = 2; lvi.mask = LVIF_TEXT;
			lvi.pszText = (LPTSTR)(LPCTSTR)strTemp;
			m_listLang.SetItem(&lvi);

			strTemp = TRL("~LANGUAGEAUTHOREMAIL");
			if(strTemp == _T("~LANGUAGEAUTHOREMAIL")) strTemp.Empty();
			lvi.iSubItem = 3; lvi.mask = LVIF_TEXT;
			lvi.pszText = (LPTSTR)(LPCTSTR)strTemp;
			m_listLang.SetItem(&lvi);

			strTemp = ff.GetFilePath();
			lvi.iSubItem = 4; lvi.mask = LVIF_TEXT;
			lvi.pszText = (LPTSTR)(LPCTSTR)strTemp;
			m_listLang.SetItem(&lvi);
		}
	}

	ff.Close();

	VERIFY(LoadTranslationTable(strActive.c_str()));
	return TRUE;
}