Click here to Skip to main content
15,908,020 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralProblem Deleting Pointer Pin
DruOfGov12-Jan-04 8:18
DruOfGov12-Jan-04 8:18 
GeneralRe: Problem Deleting Pointer Pin
Joe Woodbury12-Jan-04 8:33
professionalJoe Woodbury12-Jan-04 8:33 
GeneralRe: Problem Deleting Pointer Pin
DruOfGov12-Jan-04 8:51
DruOfGov12-Jan-04 8:51 
GeneralRe: Problem Deleting Pointer Pin
Joe Woodbury12-Jan-04 10:02
professionalJoe Woodbury12-Jan-04 10:02 
GeneralRe: Problem Deleting Pointer Pin
DruOfGov12-Jan-04 10:14
DruOfGov12-Jan-04 10:14 
GeneralRe: Problem Deleting Pointer Pin
Joe Woodbury12-Jan-04 10:34
professionalJoe Woodbury12-Jan-04 10:34 
GeneralRe: Problem Deleting Pointer Pin
DruOfGov12-Jan-04 10:38
DruOfGov12-Jan-04 10:38 
GeneralRe: Problem Deleting Pointer Pin
DruOfGov12-Jan-04 10:41
DruOfGov12-Jan-04 10:41 
bool CTexture::LoadBMPTexture( char *fileName )
{
BITMAPINFOHEADER texInfo;

if( m_pData != NULL )
{
delete [] m_pData;
m_pData = NULL;
}

if( !LoadBMPFile( fileName, &texInfo ) )
{
if( m_pData != NULL )
{
delete [] m_pData;
m_pData = NULL;
}

return false;
}


if( m_pData == NULL )
{
delete [] m_pData;
m_pData = NULL;
return false;
}

m_nWidth = texInfo.biWidth;
m_nHeight = texInfo.biHeight;
m_pPalette = NULL;
m_nScaledHeight = 0;
m_nScaledWidth = 0;
m_TextureType = BMP;

return true;
}

bool CTexture::LoadBMPFile( char *fileName, BITMAPINFOHEADER *bitmapInfoHeader )
{
FILE *fp;
BITMAPFILEHEADER bitmapFileHeader;
unsigned int imageIdx = 0;
unsigned char tempRGB;

if( ( fp = fopen( fileName, "rb" ) ) == NULL )
{
return false;
}

fread( &bitmapFileHeader, sizeof( BITMAPFILEHEADER ), 1, fp );

if( bitmapFileHeader.bfType != BITMAP_ID )
{
fclose( fp );
return false;
}

fread( bitmapInfoHeader, sizeof( BITMAPINFOHEADER ), 1, fp );

fseek( fp, bitmapFileHeader.bfOffBits, SEEK_SET );

if( m_pData != NULL )
{
delete [] m_pData;
m_pData = NULL;
}

m_pData = new unsigned char[bitmapInfoHeader->biSizeImage];

if( m_pData == NULL )
{
return false;
}

fread( m_pData, 1, bitmapInfoHeader->biSizeImage, fp );

fclose( fp );

if( m_pData == NULL )
{
delete [] m_pData;
m_pData = NULL;
return false;
}

for( imageIdx = 0; imageIdx < bitmapInfoHeader->biSizeImage; imageIdx += 3 )
{
tempRGB = m_pData[imageIdx];
m_pData[imageIdx] = m_pData[imageIdx + 2];
m_pData[imageIdx + 2] = tempRGB;
}
return true;
}
GeneralRe: Problem Deleting Pointer Pin
Joe Woodbury12-Jan-04 12:01
professionalJoe Woodbury12-Jan-04 12:01 
GeneralRe: Problem Deleting Pointer Pin
DruOfGov12-Jan-04 16:12
DruOfGov12-Jan-04 16:12 
GeneralRecompiling only modified files in vc++ environment Pin
haritadala12-Jan-04 7:53
haritadala12-Jan-04 7:53 
GeneralRe: Recompiling only modified files in vc++ environment Pin
Michael Dunn12-Jan-04 7:57
sitebuilderMichael Dunn12-Jan-04 7:57 
GeneralGateWay IP address Pin
gfds12-Jan-04 7:37
gfds12-Jan-04 7:37 
GeneralRe: GateWay IP address Pin
Jijo.Raj12-Jan-04 8:04
Jijo.Raj12-Jan-04 8:04 
Questionhow to open a closed output file(.CSV ) Pin
mr200312-Jan-04 7:32
mr200312-Jan-04 7:32 
AnswerRe: how to open a closed output file(.CSV ) Pin
Jijo.Raj12-Jan-04 7:51
Jijo.Raj12-Jan-04 7:51 
GeneralClosing all browser windows Pin
Vermithrax12-Jan-04 6:45
Vermithrax12-Jan-04 6:45 
GeneralRe: Closing all browser windows Pin
Ernesto D.12-Jan-04 11:51
Ernesto D.12-Jan-04 11:51 
GeneralRe: Closing all browser windows Pin
Vermithrax12-Jan-04 11:54
Vermithrax12-Jan-04 11:54 
Questionhow to write to a closed output file(.CSV) Pin
mr200312-Jan-04 6:32
mr200312-Jan-04 6:32 
AnswerRe: how to write to a closed output file(.CSV) Pin
Nick Hodapp12-Jan-04 6:39
sitebuilderNick Hodapp12-Jan-04 6:39 
GeneralRe: how to write to a closed output file(.CSV) Pin
mr200312-Jan-04 6:46
mr200312-Jan-04 6:46 
GeneralRe: how to write to a closed output file(.CSV) Pin
David Crow12-Jan-04 7:27
David Crow12-Jan-04 7:27 
GeneralRe: how to write to a closed output file(.CSV) Pin
Maximilien12-Jan-04 7:28
Maximilien12-Jan-04 7:28 
QuestionDouble to int? Pin
Hoornet9312-Jan-04 6:24
Hoornet9312-Jan-04 6:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.