0

When i disable desktop composition i get flickering/blinking whenever i hover the mouse over the tabs. This only happens when desktop composition is disabled. I have tried to cancel WM_ERASEBKGND message but it doesn't fix the problem. What is the solution to this problem?

This is the example that i tried to use for MASM tab control.

http://www.dreamincode.net/forums/index.php?app=core&module=attach&section=attach&attach_id=28600

The bin is already compiled.

EDIT: After enabling the WS_EX_COMPOSITED flag and added a listview control the frames of listview is not drawn. This only happens if ListView type is set to report.

Pic about the issue: enter image description here

Changing Listview type to other than Report and frames are drawn enter image description here

Removing WS_EX_COMPOSITED flag fixes the issue but the flickering comes back enter image description here

RCECoder
  • 247
  • 1
  • 5
  • 15
  • Not going to check some zip file, and it will be probably lot of code any way, but just by chance, do you draw your window content on mouse move or similar event? Do you draw it by drawing background first, and then drawing texts over it? If you are doing it often enough, and there's no offscreen buffer to compose the final state of image on screen, it will "blink" to the observer (unless your draw routine is very fast, and you sync against VSYNC, so the content of window is already drawn when the display ray does reach those pixels). (& VSYNC syncing as an event driven app may be impossible) – Ped7g Oct 15 '17 at 23:27
  • And it may work with desktop composition, because then the window manager itself composes final image from offscreen textures, so your window is drawn from there, and there's probably consistently "finished" version of your window, if you do whole drawing in some reasonable event (can't recall windows events, wasn't there something like WM_DRAW?). So your app gets event, redraws the offscreen buffer, reports event handled, then the compositor takes that as input for screen composing. .... all this is just total guessing about OS I haven't seen a decade, so take with grain of salt. – Ped7g Oct 15 '17 at 23:31
  • There is no drawing involved since it's just a dialog box based app. The dialogbox template is just stored as Dialog Box resource type and invoked through **DialogBoxParam** API. The tabs are created in response to DialogBox **WM_INITDIALOG** message through **SendDlgItemMessage** API – RCECoder Oct 15 '17 at 23:32

1 Answers1

2

Issue is fixed by using WS_EX_COMPOSITED in the Dialog box Extended styles.

EDIT: Fixes for the edit of my question is by using SetParent on the Listview and attach it to the main window as it's parent instead of the sub dialog. Now it shows its frame correctly.

So i think this one has an issue

Listview on another dialog -> attach it to the main dialog(Over tab control) using CreateDialogParam. WS_EX_COMPOSITED set on tab control

Result: has XP drawing issues. Very sluggish. Hidden frames of listview in report type. as seen in question edit.

New method Listview on another dialog -> attach it to the main dialog(Over tab control) using CreateDialogParam. WS_EX_COMPOSITED set on tab control and main dialog as well. Call SetParent associate the listview with Main dialog as it's parent.

Result: Very smooth drawing. XP has no issues either. No flickering at all even when disabling desktop composition. And leave WM_ERASEBKGND as default for main dialog and no custom WM_PRINT handling. But WM_ERASEBKGND disabling is only needed on the sub dialog DialogProc to set return to 1.

RCECoder
  • 247
  • 1
  • 5
  • 15