Click here to Skip to main content
15,922,427 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Question about trainers Pin
Ben Burnett24-Jan-03 17:26
Ben Burnett24-Jan-03 17:26 
GeneralRe: Question about trainers Pin
Weiye Chen24-Jan-03 20:56
Weiye Chen24-Jan-03 20:56 
GeneralCListCtrl and Arbitrary Data :: MFC Pin
valikac24-Jan-03 15:17
valikac24-Jan-03 15:17 
GeneralRe: CListCtrl and Arbitrary Data :: MFC Pin
Michael Dunn24-Jan-03 16:08
sitebuilderMichael Dunn24-Jan-03 16:08 
GeneralRe: CListCtrl and Arbitrary Data :: MFC Pin
valikac24-Jan-03 16:34
valikac24-Jan-03 16:34 
Generallocalization problem Pin
Lior Shoval24-Jan-03 13:11
Lior Shoval24-Jan-03 13:11 
GeneralRe: localization problem Pin
Ted Ferenc24-Jan-03 22:41
Ted Ferenc24-Jan-03 22:41 
GeneralPerformance issues - kind of big message - shoot me later... Pin
73Zeppelin24-Jan-03 13:09
73Zeppelin24-Jan-03 13:09 
Two questions - the shorter one first.
When a compiler informs you

warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)

just how much of a performance hit are we talking about?Hmmm | :|

Second (the biggie)Big Grin | :-D

In the following code excerpt (which is located in the OnDraw method of an MDI app)

// Fill the client area with black
pDC->FillRect(&rcScreen, &backgroundBrush);

// preserve the aspect ratio
CRect NewPictRect = m_pDIBBitmap->CalcAspectRatio(Rect, TRUE);


// get the bitmap
BITMAP bm;
GetObject(hBmp, sizeof(BITMAP), &bm);

// prepare the bitmapinfo structure
BITMAPINFO bmInfo;
memset(&bmInfo.bmiHeader, 0, sizeof(BITMAPINFOHEADER));
bmInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmInfo.bmiHeader.biWidth = m_pDIBBitmap->GetBitmapWidth(hBmp);
bmInfo.bmiHeader.biHeight = m_pDIBBitmap->GetBitmapHeight(hBmp);
bmInfo.bmiHeader.biPlanes = 1;
bmInfo.bmiHeader.biBitCount = 24;
////////////////****CUT HERE****////////////////////
// creates the memory dc
HDC TmpDC = CreateCompatibleDC(NULL);

// create bitmap and select into the mem dc
BYTE *pbase;
HBITMAP TmpBmp = CreateDIBSection(TmpDC, &bmInfo, DIB_RGB_COLORS, (void**)&pbase, 0, 0);

// select the object into the current dc
HGDIOBJ TmpObj = SelectObject(TmpDC, TmpBmp); // TmpDC is the dc to draw lines, text, etc...

// draw the background
HDC dcBmp = CreateCompatibleDC(TmpDC);
SelectObject(dcBmp, hBmp);
BitBlt(TmpDC, 0, 0, m_pDIBBitmap->GetBitmapWidth(hBmp), m_pDIBBitmap->GetBitmapHeight(hBmp),
dcBmp, 0, 0, SRCCOPY); // Destination DC first, then source DC
DeleteDC(dcBmp);

// Clean up
DeleteObject(hBmp);
hBmp = TmpBmp;
SelectObject(TmpDC, TmpObj);
DeleteDC(TmpDC);
////////////////*****END CUT HERE*****//////////
m_pDIBBitmap->DrawBitmap(pDC, hBmp, pPal, NewPictRect, Rect);

If I remove the code between the //////////***CUT HERE***///
bits, there is a significant decrease in redrawing speed.Suspicious | :suss: Note, however, that the call to DrawBitmap (m_pDIBBitmap->DrawBitmap(pDC, hBmp, pPal, NewPictRect, Rect) ALSO draws the bitmap, independent of the code between the CUTS... Confused | :confused:
Thus, if I remove the code between the cuts, the bitmap draws fine, but SLOW. If I keep the code the bitmap draws fine but FAST. Can't say I have figured out what is going on here. I seemed to have stumbled upon it inadvertently.
Cool | :cool:
Any input appreciated...
GeneralRe: Performance issues - kind of big message - shoot me later... Pin
Shog924-Jan-03 13:26
sitebuilderShog924-Jan-03 13:26 
GeneralRe: Performance issues - kind of big message - shoot me later... Pin
73Zeppelin24-Jan-03 13:43
73Zeppelin24-Jan-03 13:43 
GeneralRe: Performance issues - kind of big message - shoot me later... Pin
Shog924-Jan-03 13:45
sitebuilderShog924-Jan-03 13:45 
QuestionDynamic loading Kernel32.dll for backwards compatibility? Pin
Nathan Brown24-Jan-03 12:53
Nathan Brown24-Jan-03 12:53 
AnswerRe: Dynamic loading Kernel32.dll for backwards compatibility? Pin
Tim Smith24-Jan-03 15:35
Tim Smith24-Jan-03 15:35 
GeneralRe: Dynamic loading Kernel32.dll for backwards compatibility? Pin
Nathan Brown24-Jan-03 18:36
Nathan Brown24-Jan-03 18:36 
GeneralRe: Dynamic loading Kernel32.dll for backwards compatibility? Pin
Michael Dunn24-Jan-03 20:33
sitebuilderMichael Dunn24-Jan-03 20:33 
GeneralRe: Dynamic loading Kernel32.dll for backwards compatibility? Pin
Nathan Brown27-Jan-03 17:03
Nathan Brown27-Jan-03 17:03 
Generalmapfile&release&DLL Pin
georgi_tg24-Jan-03 12:09
georgi_tg24-Jan-03 12:09 
QuestionCListCtrl read-only but enabled? Pin
berndg24-Jan-03 12:04
berndg24-Jan-03 12:04 
GeneralCBN_DBLCLICK - severe confusion. Please help!!!!! Pin
ns24-Jan-03 11:09
ns24-Jan-03 11:09 
GeneralRe: CBN_DBLCLICK - severe confusion. Please help!!!!! Pin
PJ Arends24-Jan-03 12:31
professionalPJ Arends24-Jan-03 12:31 
GeneralThat helped!. One final question Pin
nss24-Jan-03 13:47
nss24-Jan-03 13:47 
GeneralRe: That helped!. One final question Pin
PJ Arends24-Jan-03 15:07
professionalPJ Arends24-Jan-03 15:07 
GeneralRe: That helped!. One final question Pin
nss25-Jan-03 4:47
nss25-Jan-03 4:47 
GeneralGetting a combobox to do some stuff Pin
ns24-Jan-03 10:34
ns24-Jan-03 10:34 
GeneralRe: Getting a combobox to do some stuff Pin
Stefan Pedersen24-Jan-03 12:47
Stefan Pedersen24-Jan-03 12:47 

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.