Solved

Blinking cursor ...

Posted on 1999-01-15
10
547 Views
Last Modified: 2013-12-03
I have a graphic application, with moving objects on a surface. I uppdate the objects with the BitBlt function.
But my cursor blinks when i put it over the objects. How can i avoid this ?
0
Comment
Question by:AndersCarlsson
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +2
10 Comments
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 1418808
I think, you can't(windows display you Image, after that
restore cursor). Other way(wuth same result!):
Hide Cursor, BitBlt, Restore Cursor.
0
 

Author Comment

by:AndersCarlsson
ID: 1418809
Yes Alex!
Same result. ShowCursor(FALSE), BitBlt ShowCursor(TRUE) gives blinking also.
Any other suggestions ?
0
 
LVL 31

Expert Comment

by:Zoppo
ID: 1418810
I think a non-blinking cursor above changing backgrounds is only possible with default cursors, which are usually handled by the graphics card.
Am I right ???
ZOPPO
0
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 1418811
New idea! Read Bar with cursor(from Screen), place to you Image,
BitBlt! Size of Bar depends from size of Cursor, of course!
0
 

Author Comment

by:AndersCarlsson
ID: 1418812
ZOPPO!
No , the system cursor also blinks!

0
 

Author Comment

by:AndersCarlsson
ID: 1418813
Alex!
Read Bar ..?
What is that?
Help me with some code please.

/Anders
0
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 1418814
dc = GetDC(NULL); Get Dc of Screen
mdc = CreateCompatibleDC(dc); //create comp(or use dc of you
Bitmap)
BitBlt(mdc,x, y, x+nWidth, y + nHeight,dc,0,0,SRCCOPY);
//where x, y, ..: coordinates of you Blinking Cursor
ReleaseDC(NULL, dc); //rekease dc of Screen

0
 
LVL 22

Accepted Solution

by:
nietod earned 100 total points
ID: 1418815
There are two fixes to this.  

First, the most common solution is to not update the portions of the screen that aren't changing.  If you are BitBlt() a new image to the entire window when only one little part is changing, that will cause the problem much more frequently.  What you should do in this case is track what portions have changed and to repaint only those portions.  This will fix the blinking in most cases, but it will still happen.  But it won't happen repeatidly so it is not annoying.  If you look carefully you will see that is how most windows programs work.

The other option is to draw the cursor on the source image before you BitBlt() it to the screen.  This will totally eliminate blinking.


0
 

Expert Comment

by:inicomp
ID: 1418816
NIETOD:
We have a similar problem. The cursor flickers not only when it is over the updated area but also when it is below and to the right of that area. We only update the changed portion of the screen.
We noticed also that the cursor flickers only on certain graphic card chipsets (ex S3 Virge, ATI Rage Pro and i740) but not on nVidia Riva128 or TNT.
And even one graphic card MGA Matrox Millenium in a dual boot system it flickers in Win95 but not in Win NT 4.0.
0
 
LVL 22

Expert Comment

by:nietod
ID: 1418817
Often The cursor will often flicker when it is near the update region, even if is not directly over it. I suspect that this is because if any portion of the cursor rectangle (even if it is not actually used as part of the cursor) overlaps the update region, the cursor is hidden before the update begins and then is restored after the update ends.  

In windows 3.1 (in my experice with it anyways) the cursor used to be hidden whenever there was an update even if it was not near it, so it used to flash like crazy.  That seems to have dissapeared in 95, for me anyways.

Some platforms like Mac and Sparc maintain the cursor in hardware, this allows the program to paint to the screen at the cursor location without it affecting the cursor.  When the cursor is moved the proper painted information is displayed.  I don't know if that is ever done in the windows world, but if so it might explain why some hardware does not flicker and some does.  
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

710 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