Click here to Skip to main content
15,905,229 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Bitmap on mfc Radio button Pin
Ravi Bhavnani30-Oct-05 6:18
professionalRavi Bhavnani30-Oct-05 6:18 
GeneralRe: Bitmap on mfc Radio button Pin
LaHaHa30-Oct-05 11:21
LaHaHa30-Oct-05 11:21 
QuestionFunction parameters tip Pin
Chintoo72328-Oct-05 23:14
Chintoo72328-Oct-05 23:14 
AnswerRe: Function parameters tip Pin
Ghasrfakhri28-Oct-05 23:58
Ghasrfakhri28-Oct-05 23:58 
GeneralRe: Function parameters tip Pin
Chintoo72329-Oct-05 1:00
Chintoo72329-Oct-05 1:00 
QuestionRe: Function parameters tip Pin
shivditya29-Oct-05 2:13
shivditya29-Oct-05 2:13 
AnswerRe: Function parameters tip Pin
ThatsAlok30-Oct-05 19:25
ThatsAlok30-Oct-05 19:25 
QuestionOdd BitBlt timings Pin
RandomMonkey28-Oct-05 20:42
RandomMonkey28-Oct-05 20:42 
I am hoping somebody can explain why the following is happening, as it makes very little sense to me.

I have an application that is updating the screen between 10ms sleep states. Depending upon screen size, there are a different number of child windows. These child windows do not overlap each other.

The problem is that when the application is relatively small, the processor is kicking over at about 6%. When the application is maximized, the processor is also kicking over at about 6%. (It seems closer to 4%, though.) Now the kicker - when it is stretched fairly big on the screen, it starts to chew up the processor - up to 20-35%.

When I first started this, the times for the maximized and small windows were about the same - 5~10% processor hit. But the non-maximized, large window time was terrible - 65%. I created a permenant memory DC, and brought the time down to ~35%. Then I changed the class style to include 'CS_OWNDC', and created a permenant 'compatible' DC, and this brought the non-maximized, large window size to about the 20% processor hit.

It makes no sense to me why the maximized application window state would chew up less processor time to draw than the large, non-maximized application window, unless Windows allocates things differently if a window is maximized, because it figures the maximized window 'hides' everything behind it?

I am running Win2000 on a AMD 2100 machine, with a relatively old 16Meg Radeon 7000 graphics card.

The code looks like the following. Each window uses exactly the same code. (I have simplified it a bit, but the pertinant part is shown.)

void GenView::paintWindow() {
   HDC dc = GetDC(thisWindowsHwnd);
   //Simply blit the bitmap onto the memory dc
   HBITMAP oldBmp = (HBITMAP) SelectObject(memoryDC, memoryBitmap);
   BitBlt(dc, 0, 0, width, height, memoryDC, 0, 0, SRCCOPY);
   SelectObject(memoryDC, oldBmp);
   ...
   }


When the window is maximized, it is performing this 8 times each 10ms pass, as there are 8 windows visible. This becomes 7 times for the problem window size, and 4 times for the minimum window size.

Any ideas on how to bring that 20% proc usage down to the 4% mark, or am I going to be stuck with that?

Thanks,
David


The following is a table overview, for reference:

State:                   Child Window Sizes:     # Windows:     Proc time:
Maximized                799(wide)x100(high)     8              4%

Large, non-maximized     608x100                 7              20%

Small                    347x100                 4              6%


Debugging - The high art and magic of cussing errors into 'features'
AnswerRe: Odd BitBlt timings Pin
Mircea Puiu28-Oct-05 21:19
Mircea Puiu28-Oct-05 21:19 
GeneralRe: Odd BitBlt timings Pin
RandomMonkey29-Oct-05 4:24
RandomMonkey29-Oct-05 4:24 
GeneralRe: Odd BitBlt timings Pin
Mircea Puiu29-Oct-05 7:32
Mircea Puiu29-Oct-05 7:32 
GeneralRe: Odd BitBlt timings Pin
RandomMonkey29-Oct-05 9:06
RandomMonkey29-Oct-05 9:06 
GeneralRe: Odd BitBlt timings Pin
Mircea Puiu29-Oct-05 9:11
Mircea Puiu29-Oct-05 9:11 
GeneralRe: Odd BitBlt timings Pin
RandomMonkey29-Oct-05 9:14
RandomMonkey29-Oct-05 9:14 
GeneralRe: Odd BitBlt timings Pin
Mircea Puiu29-Oct-05 9:22
Mircea Puiu29-Oct-05 9:22 
GeneralRe: Odd BitBlt timings Pin
RandomMonkey29-Oct-05 9:38
RandomMonkey29-Oct-05 9:38 
GeneralRe: Odd BitBlt timings Pin
RandomMonkey29-Oct-05 9:49
RandomMonkey29-Oct-05 9:49 
GeneralRe: Odd BitBlt timings Pin
RandomMonkey29-Oct-05 10:26
RandomMonkey29-Oct-05 10:26 
GeneralRe: Odd BitBlt timings Pin
ddupre29-Oct-05 11:53
ddupre29-Oct-05 11:53 
GeneralRe: Odd BitBlt timings Pin
RandomMonkey29-Oct-05 15:00
RandomMonkey29-Oct-05 15:00 
GeneralRe: Odd BitBlt timings Pin
ddupre29-Oct-05 17:45
ddupre29-Oct-05 17:45 
GeneralA Major clue Pin
RandomMonkey29-Oct-05 19:49
RandomMonkey29-Oct-05 19:49 
GeneralRe: A Major clue Pin
RandomMonkey30-Oct-05 6:10
RandomMonkey30-Oct-05 6:10 
QuestionIP range. Help Needed Pin
Radu Sorin28-Oct-05 20:40
Radu Sorin28-Oct-05 20:40 
AnswerRe: IP range. Help Needed Pin
Ghasrfakhri29-Oct-05 0:06
Ghasrfakhri29-Oct-05 0:06 

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.