Click here to Skip to main content
15,914,066 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: how do i change it Pin
David Crow29-Dec-06 3:49
David Crow29-Dec-06 3:49 
QuestionRelease mode problem ? Pin
Sakthiu28-Dec-06 23:12
Sakthiu28-Dec-06 23:12 
GeneralRe: Release mode problem ? Pin
Mila02528-Dec-06 23:28
Mila02528-Dec-06 23:28 
AnswerRe: Release mode problem ? Pin
prasad_som28-Dec-06 23:42
prasad_som28-Dec-06 23:42 
AnswerRe: Release mode problem ? [modified] Pin
CPallini29-Dec-06 0:06
mveCPallini29-Dec-06 0:06 
QuestionRe: Release mode problem ? Pin
jk chan29-Dec-06 0:21
jk chan29-Dec-06 0:21 
AnswerRe: Release mode problem ? Pin
Joan M29-Dec-06 2:35
professionalJoan M29-Dec-06 2:35 
Questionany gdi guru can help me? Pin
OmarLodhi28-Dec-06 21:44
OmarLodhi28-Dec-06 21:44 
Hi,

i load bitmap data by using fopen/fread standard c functions. after reading the whole image in a buffer i calculate bitmapfileheader and bitmapinfoheader from that buffer that is ok without any problem. now i want to draw this image but i am unable to draw it. i use CBitmap CreateBitmap function to create image from this data but when i draw the image it is in black color. here is code how i try to do it.

file = fopen("test.bmp", "rb");
fseek(file, SEEK_END, SEEK_END);
nSize = ftell(file);

byBmp = new BYTE[nSize];
fseek(file, SEEK_SET, SEEK_SET);

memset(byBmp, 0, nSize);
fread(byBmp,nSize, 1, file);

BITMAPFILEHEADER bmfh;
memcpy(&bmfh, byBmp, sizeof(bmfh));
BITMAPINFOHEADER bmih;
memcpy(&bmih, byBmp + sizeof(bmfh), sizeof(bmih));

BOOL b = m_bmpBackImage.CreateBitmap(bmih.biWidth, bmih.biHeight, bmih.biPlanes, bmih.biBitCount, NULL);

m_bmpBackImage.SetBitmapBits(bmih.biWidth*bmih.biHeight, byBmp + bmfh.bfOffBits);


somewhere onpaint event i try to draw this bitmap but end result is black image.

please help how can i create image from a buffer data. is there any thing that i am missing.

thanks in advance.

Omar Lodhi

AnswerRe: any gdi guru can help me? Pin
Cristian Amarie28-Dec-06 22:31
Cristian Amarie28-Dec-06 22:31 
GeneralRe: any gdi guru can help me? Pin
OmarLodhi28-Dec-06 23:20
OmarLodhi28-Dec-06 23:20 
GeneralRe: any gdi guru can help me? Pin
Cristian Amarie28-Dec-06 23:26
Cristian Amarie28-Dec-06 23:26 
GeneralRe: any gdi guru can help me? Pin
OmarLodhi29-Dec-06 4:10
OmarLodhi29-Dec-06 4:10 
AnswerRe: any gdi guru can help me? Pin
Gary R. Wheeler29-Dec-06 6:01
Gary R. Wheeler29-Dec-06 6:01 
AnswerRe: any gdi guru can help me? Pin
Hamid_RT29-Dec-06 17:42
Hamid_RT29-Dec-06 17:42 
GeneralRe: any gdi guru can help me? Pin
OmarLodhi30-Dec-06 4:40
OmarLodhi30-Dec-06 4:40 
AnswerRe: any gdi guru can help me? Pin
Mark Salsbery30-Dec-06 8:38
Mark Salsbery30-Dec-06 8:38 
AnswerRe: any gdi guru can help me? Pin
Mark Salsbery30-Dec-06 10:05
Mark Salsbery30-Dec-06 10:05 
GeneralRe: any gdi guru can help me? Pin
OmarLodhi31-Dec-06 19:07
OmarLodhi31-Dec-06 19:07 
GeneralRe: any gdi guru can help me? [modified] Pin
Mark Salsbery1-Jan-07 11:22
Mark Salsbery1-Jan-07 11:22 
GeneralRe: any gdi guru can help me? Pin
OmarLodhi2-Jan-07 14:59
OmarLodhi2-Jan-07 14:59 
NewsHiEdit V1.0.1.4 [modified] Pin
akyprian28-Dec-06 21:33
akyprian28-Dec-06 21:33 
QuestionAnd the question is? Pin
CPallini28-Dec-06 21:43
mveCPallini28-Dec-06 21:43 
AnswerRe: And the question is? Pin
akyprian28-Dec-06 21:50
akyprian28-Dec-06 21:50 
GeneralRe: And the question is? Pin
prasad_som28-Dec-06 22:22
prasad_som28-Dec-06 22:22 
GeneralRe: HiEdit V1.0.1.4 Pin
ThatsAlok28-Dec-06 23:00
ThatsAlok28-Dec-06 23:00 

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.