Search code examples
assemblytabsmasmmasm32windows-messages

Disabling desktop composition causes flickering on Tab Control


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


Solution

  • 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.