Solved

Using BitBlt() Function !!

Posted on 2002-04-20
1
589 Views
Last Modified: 2013-11-20
Hello Experts !!

I developed an SDI application which displays a Bitmap !! I call UpdateAllViews(NULL) very frequently when a MOUSE_MOVE message is sent. The problem is that the bitmap flickers a lot. I wanna reduce or simple avoid flickering, which is why I'm using BitBlt() function. but still It seems to flicker.

This is the code I've written;

CPaintDC dc(this);
CDC memDC;
memDC.CreateCompatibleDC(&dc);

CBitmap bm;
bm.LoadBitmap(IDB_BITMAP1);

memDC.SelectObject(bm);
CRect rc;
GetClientRect(&rc);
OnDraw(&dc);
dc.BitBlt(0,0,rc.Width(), rc.Height(), &memDC,0,0,BLACKNESS);

Can somebody tell me why this does not work as expected.

--Din--
0
Comment
Question by:dineth
1 Comment
 

Accepted Solution

by:
muneeb_baig earned 100 total points
ID: 6957396
Don't call UpdateAllViews into Mouse Move event, and also don't try to redraw all bitmap into Mouse move event.  

If you are doing editing into mouse move, then set the writting style to R2_NOT by calling funtion SetROP2.  

e.g if you are drawing a rectangle, then on each mouse move you erase the previous ractangle and create a new one.  
This way there will be no flicker at all.  

I think you got my point.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now