Due to the issue rised after i used WX_EX_COMPOSITED i was forced to turn it off since it wasn't compatible with listview with report type set.
Disabling desktop composition causes flickering on Tab Control
Now whenever i resize the TAB control along with resizing the main dialog in response to any one of the messages WM_SIZE,WM_SIZING,WM_WINDOWPOSCHANGED messages
invoke GetClientRect,hWnd,addr CLRECT
LEA EAX, CLRECT
invoke MoveWindow,MainTabHandle,NULL,NULL,[EAX].RECT.right,[EAX].RECT.bottom,TRUE
There is a lot of flickering going with the TAB control.
I have already turned off WM_ERASEBKGND message by returning true to the default window procedure.
.elseif uMsg == WM_ERASEBKGND
MOV EAX,1
RET
and handling WM_PRINT message on my own using this article that i have read from Microsoft.
https://msdn.microsoft.com/en-us/library/ms969905.aspx
WM_PRINT message handler
invoke BeginPaint,hWnd,addr PS
invoke Paint,hWnd,addr PS
invoke EndPaint,hWnd,addr PS ;PS is just a LOCAL PAINTSTRUCT structure used for painting
Paint procedure after i ported it from C++ to MASM
Paint Proc hWnd:DWORD, pPAINTSTRUCT:PPAINTSTRUCT
LOCAL rc:RECT ;
LOCAL hdcMem:HDC ;
LOCAL hBITMAP:HANDLE
LOCAL hbmMem:HANDLE
LOCAL hbmOld:HANDLE
LOCAL hbrBkGnd:HBRUSH ;
LOCAL hfntOld:HFONT ;
invoke GetClientRect,hWnd,addr rc
MOV EAX,pPAINTSTRUCT
invoke CreateCompatibleDC,[EAX].PAINTSTRUCT.hdc
MOV hdcMem ,EAX
MOV EAX,pPAINTSTRUCT
invoke CreateCompatibleBitmap,[EAX].PAINTSTRUCT.hdc,rc.right,rc.bottom
MOV hbmMem,EAX
invoke SelectObject,hdcMem,hbmMem
MOV hbmOld,EAX
invoke GetSysColor,COLOR_WINDOW
invoke CreateSolidBrush,EAX
MOV hbrBkGnd,EAX
invoke FillRect,hdcMem,addr rc,hbrBkGnd
invoke DeleteObject,hbrBkGnd
.if hfnt
invoke SelectObject,hdcMem,hfnt
MOV hfntOld,EAX
.endif
invoke SetBkMode,hdcMem,TRANSPARENT
invoke GetSysColor,COLOR_WINDOWTEXT
invoke SetTextColor,hdcMem,EAX
invoke DrawText,hdcMem,addr szCaption,-1,addr rc,DT_CENTER
invoke SelectObject,hdcMem,hfntOld
MOV EAX,pPAINTSTRUCT
LEA EBX,rc
MOV EDX,[EBX].RECT.right
SUB EDX,[EBX].RECT.left
MOV ECX,[EBX].RECT.bottom
SUB ECX,[EBX].RECT.top
invoke BitBlt,[EAX].PAINTSTRUCT.hdc,rc.left,rc.top,EDX,ECX,hdcMem,0, 0,SRCCOPY
invoke SelectObject,hdcMem, hbmOld
invoke DeleteObject,hbmMem;
invoke DeleteDC,hdcMem;
The Paint function seems to work fine since if i omit the call to it, there is a drawing issue when resizing to extend the width of the main dialog the new area is just black. But if i call paint then the new area after resize is drawn correctly. But there is huge amount of flickering.
I have 3 dialog boxes one is the main dialog invoked through DialogBoxParam API
And the other 2 are just modeless dialog boxes(with no caption and it's Style is set to DS_SYSMODAL) these dialog boxes will be attached to the TAB control through CreateDialogParam API call each one has it's own unique DlgProc.
Now what should i do to avoid control resizing flickering? should i do sub-classing to the control that i want to resize? and disable WM_ERASEBKGND for each control individually?
Is disabling the WM_ERASEBKGND message need to be done only in the main dialog or for all modeless dialogboxes as well?
Any one could help about this matter?