Click here to Skip to main content
16,011,542 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Sending a raw UDP packet from win9x Pin
Kuniva16-Jun-03 6:05
Kuniva16-Jun-03 6:05 
GeneralHelp me, Full Owner Draw CEdit Control Pin
Anonymous15-Jun-03 3:59
Anonymous15-Jun-03 3:59 
GeneralRe: Help me, Full Owner Draw CEdit Control Pin
Iain Clarke, Warrior Programmer15-Jun-03 5:35
Iain Clarke, Warrior Programmer15-Jun-03 5:35 
GeneralRe: Help me, Full Owner Draw CEdit Control Pin
zjkw15-Jun-03 6:16
zjkw15-Jun-03 6:16 
GeneralDIBs and BMP's Pin
Tommy2k15-Jun-03 2:41
Tommy2k15-Jun-03 2:41 
GeneralRe: DIBs and BMP's Pin
Gary R. Wheeler15-Jun-03 3:07
Gary R. Wheeler15-Jun-03 3:07 
GeneralRe: DIBs and BMP's Pin
Tommy2k15-Jun-03 4:35
Tommy2k15-Jun-03 4:35 
GeneralRe: DIBs and BMP's Pin
Ryan Binns15-Jun-03 5:01
Ryan Binns15-Jun-03 5:01 
You don't need to create the second bitmap, as it is returned by SelectObject(). Also, you're overwriting memBM with the second SelectObject(). Try this:

HDC hDC = GetDC();
HDC memDC = CreateCompatibleDC ( hDC );
HBITMAP memBM = CreateCompatibleBitmap (hDC,dib->biWidth,dib->biHeight);
HBITMAP memBM2;
memBM2 = (HBITMAP)SelectObject ( memDC, memBM );

StretchDIBits(memDC,0,0,dib->biWidth,dib->biHeight,0,0,dib->biWidth,dib->biHeight,lpbits,
    (LPBITMAPINFO)&dib,DIB_RGB_COLORS,SRCCOPY);

SelectObject(memDC,memBM2);
ReleaseDC(memDC);

CStatic *temp = (CStatic*)GetDlgItem (IDC_LOGO);
temp->SetBitmap((HBITMAP)memBM);


Also make sure that your BITMAPINFOHEADER is setup correctly. I assume it is because you mentioned you can draw it elsewhere. If the image is 256 colours or less, the BITMAPINFOHEADER structure is NOT equivalent to a BITMAPINFO structure. The BITMAPINFO structure contains a BITMAPINFOHEADER plus the colour table. If the image has more than 256 colours, the colour table is not used and not required. For less than 256 colours it is.

Ryan

Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)

Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"

GeneralRe: DIBs and BMP's Pin
Ryan Binns15-Jun-03 3:08
Ryan Binns15-Jun-03 3:08 
GeneralRe: DIBs and BMP's Pin
Gary R. Wheeler15-Jun-03 3:30
Gary R. Wheeler15-Jun-03 3:30 
GeneralRe: DIBs and BMP's Pin
Ryan Binns15-Jun-03 3:40
Ryan Binns15-Jun-03 3:40 
GeneralRe: DIBs and BMP's Pin
Tommy2k15-Jun-03 4:43
Tommy2k15-Jun-03 4:43 
GeneralRe: DIBs and BMP's Pin
Ryan Binns15-Jun-03 4:53
Ryan Binns15-Jun-03 4:53 
GeneralRe: DIBs and BMP's Pin
Tommy2k15-Jun-03 5:08
Tommy2k15-Jun-03 5:08 
GeneralGetFieldValue and Thread ... Pin
Hadi Rezaee15-Jun-03 2:29
Hadi Rezaee15-Jun-03 2:29 
GeneralA modal dlg in muli-thread Pin
FlyingDancer15-Jun-03 2:28
FlyingDancer15-Jun-03 2:28 
GeneralRe: A modal dlg in muli-thread Pin
Gary R. Wheeler15-Jun-03 3:14
Gary R. Wheeler15-Jun-03 3:14 
GeneralRe: A modal dlg in muli-thread Pin
FlyingDancer15-Jun-03 3:27
FlyingDancer15-Jun-03 3:27 
GeneralRe: A modal dlg in muli-thread Pin
Gary R. Wheeler15-Jun-03 3:34
Gary R. Wheeler15-Jun-03 3:34 
GeneralRe: A modal dlg in muli-thread Pin
FlyingDancer15-Jun-03 3:43
FlyingDancer15-Jun-03 3:43 
Generaldrag and drop Pin
shanila15-Jun-03 0:56
shanila15-Jun-03 0:56 
QuestionWhy won't CStatic paint? Pin
murdoc515014-Jun-03 23:45
murdoc515014-Jun-03 23:45 
AnswerRe: Why won't CStatic paint? Pin
Stan the man15-Jun-03 2:34
Stan the man15-Jun-03 2:34 
GeneralRe: Why won't CStatic paint? Pin
murdoc515015-Jun-03 3:29
murdoc515015-Jun-03 3:29 
GeneralRe: Why won't CStatic paint? Pin
Stan the man15-Jun-03 15:25
Stan the man15-Jun-03 15:25 

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.