Click here to Skip to main content
15,912,977 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Reinterpreting a keypress? Pin
Nish Nishant16-Aug-02 10:18
sitebuilderNish Nishant16-Aug-02 10:18 
AnswerRe: Reinterpreting a keypress? Pin
moredip16-Aug-02 10:18
moredip16-Aug-02 10:18 
GeneralC++ exe displayed using java Pin
IGeorgeI16-Aug-02 8:45
IGeorgeI16-Aug-02 8:45 
GeneralRe: C++ exe displayed using java Pin
Nish Nishant16-Aug-02 10:21
sitebuilderNish Nishant16-Aug-02 10:21 
GeneralRe: C++ exe displayed using java Pin
includeh1017-Aug-02 3:01
includeh1017-Aug-02 3:01 
QuestionHow to set Quota Limit on a disk in VC++? Pin
Tida16-Aug-02 8:13
Tida16-Aug-02 8:13 
AnswerRe: How to set Quota Limit on a disk in VC++? Pin
Tomasz Sowinski16-Aug-02 8:43
Tomasz Sowinski16-Aug-02 8:43 
GeneralBitmap question Pin
Chun Te, Ewe16-Aug-02 8:11
Chun Te, Ewe16-Aug-02 8:11 
Dear all,

This problem of mine has been bugging me crazy.
I have to load a 24bit .bmp file and convert it to a 32 bit bmp file.

I've manage to load the bitmap file, display it on the screen and even made the code to make it a 32bit bitmap.

The problem is to attach the modified bits to the m_bmpBitmap CBitmap object. Then I get the info of the m_bmpBitmap with the BITMAP structure.
BITMAP bm;
m_bmpBitmap.GetBitmap(&bm);
The bm.bmBits is 0x0 which it shouldn't be.

All the CreateBitmap() and GetBitmap() funtions return successful but I can't even display the image to screen and I feel it is due to bm.bmBits = 0x0.
I've even tried to create a 24 bit bitmap with the same method below and it didn't work too.

I would like to be able to view the image that I created and as well as to be able to save it. I welcome any new ideas on how to approach this matter.

Many many thanks.
Chun Te, Ewe

-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

CBitmap m_bmpBitmapOri;
CBitmap m_bmpBitmap;
BYTE *m_pOriSrc, *m_pSrc;

HBITMAP hBitmap = (HBITMAP) ::LoadImage(AfxGetInstanceHandle(), "h:\\logo.bmp"
,IMAGE_BITMAP, 0, 0, R_LOADFROMFILE | LR_CREATEDIBSECTION);

m_bmpBitmapOri.Attach(hBitmap);

BITMAP bmOri;
m_bmpBitmapOri.GetBitmap(&bmOri); // Get the loaded bitmap
m_pOriSrc = (BYTE*)bmOri.bmBits; // Pointer to the original bitmap bits

// Prepare a new location
if(m_pSrc!=NULL) delete [] m_pSrc;
m_pSrc = new BYTE[(bmOri.bmHeight+1)*bmOri.bmWidth*4];

...
some code to change from 24bpps to 32 bpps (if needed I can provide)
...

if (m_bImageValid) m_bmpBitmap.DeleteObject();
// Creating the image
m_bmpBitmap.CreateBitmap( bmOri.bmWidth, bmOri.bmHeight, 1, 32, m_pSrc );

BITMAP bm; // Obtain info regarding bitmap
m_bmpBitmap.GetBitmap(&bm); //

// Create a device contect to load the bitmap into
CDC dcMem;
CClientDC pDC(this);
dcMem.CreateCompatibleDC(&pDC);

dcMem.SelectObject(m_bmpBitmap);
pDC.BitBlt(250, 7, bm.bmWidth, bm.bmHeight, &dcMem, 0, 0, SRCCOPY);
// Won't display image

GeneralEdit Box Scrolling Pin
Ken Mazaika16-Aug-02 7:38
Ken Mazaika16-Aug-02 7:38 
GeneralRe: Edit Box Scrolling Pin
Ken Mazaika16-Aug-02 8:43
Ken Mazaika16-Aug-02 8:43 
Generalrelease vs debug builds problem Pin
ns16-Aug-02 5:49
ns16-Aug-02 5:49 
GeneralRe: release vs debug builds problem Pin
PJ Arends16-Aug-02 5:59
professionalPJ Arends16-Aug-02 5:59 
GeneralRe: release vs debug builds problem Pin
ns16-Aug-02 6:12
ns16-Aug-02 6:12 
GeneralRe: release vs debug builds problem Pin
Roger Allen16-Aug-02 6:33
Roger Allen16-Aug-02 6:33 
GeneralRe: release vs debug builds problem Pin
ns16-Aug-02 7:20
ns16-Aug-02 7:20 
GeneralRe: release vs debug builds problem Pin
Michael Dunn16-Aug-02 9:41
sitebuilderMichael Dunn16-Aug-02 9:41 
GeneralRe: release vs debug builds problem Pin
ns16-Aug-02 10:09
ns16-Aug-02 10:09 
GeneralRe: release vs debug builds problem Pin
Tomasz Sowinski16-Aug-02 6:58
Tomasz Sowinski16-Aug-02 6:58 
GeneralWM_KILLFOCUS Pin
Anonymous16-Aug-02 5:37
Anonymous16-Aug-02 5:37 
GeneralRe: WM_KILLFOCUS Pin
PJ Arends16-Aug-02 5:41
professionalPJ Arends16-Aug-02 5:41 
GeneralRe: WM_KILLFOCUS Pin
NC16-Aug-02 7:22
NC16-Aug-02 7:22 
GeneralRe: WM_KILLFOCUS Pin
PJ Arends16-Aug-02 14:58
professionalPJ Arends16-Aug-02 14:58 
GeneralRe: WM_KILLFOCUS Pin
NC19-Aug-02 1:49
NC19-Aug-02 1:49 
QuestionIs there a way to see if a SOCKET is connected? Pin
Le centriste16-Aug-02 4:40
Le centriste16-Aug-02 4:40 
AnswerRe: Is there a way to see if a SOCKET is connected? Pin
Masaaki Onishi16-Aug-02 7:21
Masaaki Onishi16-Aug-02 7:21 

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.