Exemplo n.º 1
0
void DeleteDirectory( CxString strDirectory )
{
	WIN32_FIND_DATA FindFileData;
	HANDLE hFind;

	BOOL bWorking = TRUE;
	CxString strDirFile = strDirectory + CxString("\\*.*");
	hFind = ::FindFirstFile( strDirFile, &FindFileData );
	while ( hFind != INVALID_HANDLE_VALUE )
	{
		if ( (FindFileData.cFileName[0] == _T('.') && FindFileData.cFileName[1] == _T('\0')) ||
			(FindFileData.cFileName[0] == _T('.') && FindFileData.cFileName[1] == _T('.')  && FindFileData.cFileName[2] == _T('\0')) )
		{
			if ( !::FindNextFile( hFind, &FindFileData ) )
				break;
			continue;
		}

		CxString strPathName;
		strPathName.Format( _T("%s\\%s"), strDirectory, FindFileData.cFileName );

		if ( !!(FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) )
		{
			DeleteDirectory( strPathName );
		}
		else
		{
			::DeleteFile( strPathName );
		}
		if ( !::FindNextFile( hFind, &FindFileData ) )
			break;
	}
	::FindClose( hFind );
	::RemoveDirectory( strDirectory );
}
Exemplo n.º 2
0
CxSimpleADO::IFieldPtr CxSimpleADO::IRecordSetPtr::GetField(int index)
{
    CxADOField* pField = NULL;
    try
    {
        CxADOField field = m_pRecordSet->GetField(index);
        pField = new CxADOField(field);
    }
    catch (_com_error& e)
    {
        CxString strError;
        strError.Format( _T("DB FIELD Error! Code: %08lx, Description: %s\n"), e.Error(), (LPCTSTR)(e.Description()) );
        XTRACE( strError );
    }
    return IFieldPtr(pField);
}
Exemplo n.º 3
0
CxString GetExecuteFile()
{
	TCHAR    chPath[_MAX_PATH];
	TCHAR    chDrive[_MAX_DRIVE];
	TCHAR    chDir[_MAX_DIR];
	TCHAR    chFName[_MAX_FNAME];
	TCHAR    chExt[_MAX_EXT];
	CxString strFile;

	::GetModuleFileName(NULL, chPath, MAX_PATH);
	_tsplitpath(chPath, chDrive, chDir, chFName, chExt);
	strFile.Format(_T("%s"), chFName);
	strFile.MakeUpper();

	return strFile;
}