IMHO DrawDIB() code has an error. As I know you cannot do such things as :
BITMAPINFO &bmInfo = *(LPBITMAPINFO)hDIB;
It's wrong because HANDLE is not the same as void* ,it is just declared so. If you do so, bmInfo is filled in with garbage. If you want to get access to the real pointer to data of handle - must use GlobalLock() function
It can be like that:
...
PVOID pDIB = GlobalLock(hDIB);
if(!pDIB)
{
//Memory error
...
};
BITMAPINFO &bmInfo = *(LPBITMAPINFO)pDIB;
...
...
...
GlobalUnlock(hDIB);
Reply
Originally posted by: nizom
I'm a newbee at Visual C++ and i just want to know how to put a bmp file on the screen of my programs. tell me the libraries that i would need to u too.
Reply
Originally posted by: nizom
Code for transferring a BMP file to another user
Originally posted by: Peter Zhou
I want to show a bitmap with a palette which has 256 gray colors. I wrote your codes in OnDraw() function but it doesn't work.
I found out that
RC_PALETTE & pDC->GetDeviceCaps(RASTERCAPS) is always zero.
Can anyone tell me whether I shouldn't write my codes in OnDraw function or it's a problem of my adapter driver?
Cheers.
ReplyOriginally posted by: Datta Kandalkar Kondaji
How can i resize the view and frame size accordint to the bitmap size. i.e. when i load a bitmap i want the view and the fram size to be adjusted according to the size of bitmap. If the bitmap is very big i.e biggier then the normal size of the view then scroll bar should be added. I am using SDI in MFC. How should i achieve this.
Thanking in advance
ReplyOriginally posted by: panduka
How can I Loard Bimap when Run time.I need Full Programe Using MFC Visuall C++ Dialog Base project.
ReplyOriginally posted by: kmnaveed
i want to an animaed icon on my dialog instead of MFC standard icon Plz help me.Thank you.
Originally posted by: saima
I want to create animation using bitmap .I do heard about bitblt and others but no onw helps in getting starting .Plz i need help .So,any one knows he's welcome.i want to show moving wavforms in mine animation with time on x-axis and voltages on y-axis.
thanx
Originally posted by: Christina
Hi, could anyone tell me if there are supposed to be header files included, and what are they? Otherwise, what are the types CDC, HGLOBAL, and CPallete?
Thank you
Originally posted by: Raju Selvaraj
Dear friend i tried this code but when GetBitampAndPallete function call is encountered in OnPaint function,the "GetBitampAndPallete " is not called .So iam able to see only the black & white Images.Can u help me.
iam working in VC++6.