Hi all,
I want to display a bitmap which is created by the program and want it to be displayed on a dialog box when the program is still drawing the bitmap. I'd tried for long time but seems no work. I'd made a source code like this:

BITMAP bm;
m_ImageWidth = 128;
m_ImageHeight = 128;
m_hC340Image = ::CreateBitmap( m_ImageWidth, m_ImageHeight, 1, 24, NULL );

//Set Initial Value of Bitmap to RGB(255,0,0)
::GetObject( m_hC340Image, sizeof( BITMAP ), &bm );
unsigned char* pData = new unsigned char
[ bm.bmHeight*bm.bmWidthBytes ];
for( j=0; j<bm.bmHeight; j++ )
for( i=0; i<bm.bmWidth; i++ )
{
pData[ i*3+j*bm.bmWidthBytes ] = 0; //B
pData[ i*3+1+j*bm.bmWidthBytes ] = 0; //G
pData[ i*3+2+j*bm.bmWidthBytes ] = 255; //R
}
::SetBitmapBits( m_hC340Image, bm.bmHeight*bm.bmWidthBytes, pData );

delete [] pData;

//show image
m_ctrlC340Image.SetBitmap( m_hC340Image );
UpdateData(false);




The above is part of the sourcecode of a dialog box. The result should be a red square on a dialog, but none was drawn. However, when I use LoadBitmap() function, a bitmap can be shown on the dialog correctly. What's wrong with it? Could anyone please kind to tell me how to make the code?