예제 #1
0
BOOL CProcess::CheckImageName( LPCTSTR lpszImageName )
{
	CString strImageName(lpszImageName);
	
	strImageName.MakeLower();

	CString strTmp = GetFileName().MakeLower();

	if (strTmp.Find(strImageName) >= 0)
	{
		return TRUE;
	}

	return FALSE;
}
예제 #2
0
CImage *AquireImage( HINSTANCE hInstance, LPCTSTR pcszFilePath, LPCTSTR pcszFilename )
{
	CImage *pImage = NULL;

	//
	//	Check for resource based images
	if( !_tcsnicmp( pcszFilename, _T("RES:"), 4 ) )
	{
		pcszFilename += 4;
		ASSERT( _tcslen( pcszFilename  ) );
		pImage = new CImage;
		if( !pImage->Load( hInstance, pcszFilename ) )
		{
			LPTSTR endptr;
			if( !pImage->Load( hInstance, MAKEINTRESOURCE( _tcstol( pcszFilename, &endptr, 10 ) ) ) )
			{
				delete pImage;
				pImage = NULL;
			}
		}
		return pImage;
	}

	//
	//	Check for file based images
	StringClass strImageName( pcszFilePath );
	strImageName += pcszFilename ;

	pImage = new CImage;
	if( !pImage->Load( strImageName ) )
	{
		delete pImage;
		pImage = NULL;
	}
	return pImage;
}
예제 #3
0
파일: aquireimage.cpp 프로젝트: F5000/spree
CQHTMImageABC *AquireImage( HINSTANCE hInstance, LPCTSTR pcszFilePath, LPCTSTR pcszFilename, bool bIsTransparent, COLORREF crForceTransparent )
{
	CQHTMImage *pImage = NULL;

	pImage = new CQHTMImage;

	//
	//	Check for resource based images
	if( !_tcsnicmp( pcszFilename, _T("RES:"), 4 ) )
	{
		pcszFilename += 4;
		ASSERT( _tcslen( pcszFilename  ) );
		if( LoadFromResource( pImage, hInstance, pcszFilename ) )
		{
			if( bIsTransparent ) pImage->ForceTransparent( crForceTransparent );
			return pImage;
		}

		LPTSTR endptr;
		if( LoadFromResource( pImage, hInstance, MAKEINTRESOURCE( _tcstol( pcszFilename, &endptr, 10 ) ) ) )
		{
			if( bIsTransparent ) pImage->ForceTransparent( crForceTransparent );
			return pImage;
		}


		//
		//	Here we attempt to read the resource given the name RES:exeORdll:number
		//	However, despite out valiant efforts it has not worked, at least not for icons
		HMODULE hOther = NULL;
		LPTSTR pszNumber = _tcsrchr( pcszFilename, ':' );
		if( pszNumber )
		{
			*pszNumber = '\000';
			hOther = LoadLibraryEx( pcszFilename, NULL, LOAD_LIBRARY_AS_DATAFILE );
			pcszFilename = pszNumber + 1;
		}
		else
		{
			hOther = LoadLibraryEx( pcszFilename, NULL, LOAD_LIBRARY_AS_DATAFILE );
		}
		
		if( hOther )
		{

			if( LoadFromResource( pImage, hOther, pcszFilename ) )
			{
				if( bIsTransparent ) pImage->ForceTransparent( crForceTransparent );
				return pImage;
			}

			LPTSTR endptr;
			if( LoadFromResource( pImage, hOther, MAKEINTRESOURCE( _tcstol( pcszFilename, &endptr, 10 ) ) ) )
			{
				if( bIsTransparent ) pImage->ForceTransparent( crForceTransparent );
				return pImage;
			}
		}
		pImage->Destroy();
		return NULL;
	}

	//
	//	Check for file based images
	StringClass strImageName( pcszFilePath );
	strImageName += pcszFilename ;

	CFileDataSource file;
	if( file.Open( pcszFilename ) || file.Open( strImageName ) )
	{
		if( pImage->Load( file ) )
		{
			if( bIsTransparent ) pImage->ForceTransparent( crForceTransparent );
			return pImage;
		}
	}

	pImage->Destroy();
	return NULL;
}