Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Odd behaviour of labels using Windows7 64 bit

Status
Not open for further replies.

tedsmith

Programmer
Nov 23, 2000
1,762
0
0
AU
When I run a program (or test it in the IDE) in a Win7 64 bit computer (3 ghz I7), changing the text in a label or a rich text box causes the whole text line to annoyingly blink. When I run the same exe run in a Windows XP or an old slow Winm98 computer, changes to the text are instant with no gap.

To test this I added a 1 second timer and showed the time changing each second. About every 7 seconds I get no blink but all other second the whole label text blinks as it changes. The text appears to momentarily disappear before the new text is shown. In previous OSs the new text simply replaces the old text with no gap.

If i use a 2 line high rich text box and show the date on the top line and the time on the bottom line in one statement only the time line blinks as each second ticks by, the date line is steady. [Date() & vbcr & Time()]

Could this be something to do with the video card even though it is a fast one that shows HD video editing very well( Maybe the card and computer are too fast?

I have used 32 bit WIN7 in other computers before without this problem.
Compatibility mode makes no difference.
Colors of text and background make no difference.
Making the an identical test prog on an XP computer still blinks on the Win7 64 bit but not on the XP computer.
 
Sounds like a symptom of Desktop Composition.

As far as I know you'd need to use something like DirectX for rendering instead of the GDI-based controls. This has an impaact on lots of software, not just VB6 programs.


As an analogy, it is almost as if you were running an RDP client on the desktop that talks to the "real" desktop layer underneath that.
 
Any suggestions as to how I should change it to Direct X if this is the case?

The computer has 2 ATI Radeon 5700 cards. Nowhere in the control panel or Catalyst control center is there a reference to Direct X or GDI options like I seem to remember I have seen in other card's control panels.
HD videos play perfectly so I suspect it is a VB6 related problem.

When I get a chance I'll try an different more simple video card from a 32bit machine.
 
Should be an easy thing to test.

If you are running Windows 7 you are still able to turn off desktop composition, see Disable Windows Aero | Windows 7, Vista.

Turn Aero off, then test your program. Turn it back on after testing.

If this is the problem there isn't much you can do aside from rewriting your program significantly to use a DirectX user interface instead of normal VB6 Forms and Controls which are based on the GDI rendering subsystem. This isn't practical because the DirectX wrappers VB6 needed were not produced past DirectX 7 (Windows XP).

Some alternative widget libraries use 3rd party rendering libraries such as Cairo. vbRichClient is one you could look at. I don't know whether this would solve your "blinking" issues.
 
There are some hacks that date back to VB3 that can be used. These haven't applied for a long time but conditions have changed to put VB at a disadvantage again.

See PRB: How to Prevent Flicker in the Repaint of a Label.

I think the problem involves synchronizing display updates with the refresh interval. This is where DirectX would come in for example. It has little to do with video hardware, but how Windows uses the hardware post-XP.
 
Thanks.
I had tried everything suggested except the picture box method which works perfectly.

Strangely the ordinary label also works flicker free as long as you have a blank visible Picturebox and include Picturebox1.cls just before you update the label! No need to feed the date to the picturebox.

In future I'll just use the picturebox instead of the label for things like showing the time of day that change every second.

Another holy mystery as my sainted mother used to say when asked where do babies come from.
 
Further.
I had the desktop set to non-aero because it interferes with using the IDE when designing forms but when I set to Aero, the blinking problem disappears on labels even without a picturebox.
 
Well keep in mind that Aero is gone post-Win7... er, or modified somewhat.

Seems WinRT XAML rendering had issues. So since "baby can't eat steak" we all get pablum now, even if we completely eschew the Metro travesty.

Just saying... be prepared for further disappointment.
 
Yes, good point. Must try out a VB6 app on W10 this afternoon
 
Well for testing this sort of thing you may need to have it installed on real hardware, not in a VM.
 
Hmmm. VirtualBox, which I'm using, has emulated the hardware the hardware necessary to support DWM properly since version 4.1.However, it is also fair to say that that requires the VirtualBox Guest Additions to be installed - and those have not been updated yet to work with W10
 
Now updated. DWM working as expected on W10 under VirtualBox
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top