flat assembler
Message board for the users of flat assembler.
Index
> Windows > I like print text on static windows. But blink staticHwnd. |
| Author |
|
|
revolution 16 Aug 2026, 11:50
The recommend way to repaint without "blinking" is to create an in-memory bitmap, erase/paint/update the bitmap. Then BitBlt to the screen, overwriting the previous pixels without erasing them first.
IIRC there is an OWNERDRAW property to have Windows call the custom update code, instead of using the default library code. |
|||
|
|
Roman 16 Aug 2026, 12:03
I try do this.
Code: proc StaticWndProc hwnd, msg, wParam, lParam .if [msg] = WM_PAINT invoke BeginPaint,[hwnd],ps rept 0 { invoke GetDesktopWindow invoke GetWindowDC,eax } ;invoke GetDC,[StaticInfoHwnd] mov [.DC],eax invoke GetClientRect,[hwnd],.rect invoke CreateCompatibleDC,[.DC] mov [.memDC],eax mov ecx,[.rect+8] sub ecx,[.rect] mov edx,[.rect+12] sub edx,[.rect+4] push edx ecx invoke CreateCompatibleBitmap,[.DC], ecx, edx mov ebx,eax invoke SelectObject,[.memDC], eax ;draw ;invoke FillRect,[.memDC],.rect,COLOR_WINDOW+2 inc byte [.txt] invoke SetBkColor,[.memDC],0 invoke SetTextColor,[.memDC],0x00ffffff invoke TextOut,[.memDC], [.rect], 100, .txt , 17 ;invoke Sleep,1200 pop ecx edx invoke BitBlt,[.DC], 0, 0, ecx, edx,[.memDC], 0, 0, SRCCOPY invoke SelectObject,[.memDC],0 invoke EndPaint,[hwnd],ps invoke DeleteObject,ebx invoke DeleteDC,[.memDC] ;invoke UpdateWindow,[hwnd] ;invoke ShowWindow,[hwnd],1 xor eax,eax ret .endif invoke DefWindowProc, [hwnd], [msg], [wParam], [lParam] ;invoke CallWindowProc, GWL_WNDPROC ,[hwnd], [msg], [wParam], [lParam] ;mov eax,0 ret .txt db "0 Text of text out",0 .rect dd 0,0,0,0 .DC dd 0 .memDC dd 0 ps dd 0,0,0,0,0,0 StaticInfoHwnd dd 0 endp invoke CreateWindowEx, WS_EX_TOPMOST, 'static', "",SS_CENTER+WS_VISIBLE+SS_OWNERDRAW,\ 900, 0,dword 340, dword 580, 0, 0,0, 0 mov [StaticInfoHwnd],eax invoke SetWindowLong,eax, GWL_WNDPROC, StaticWndProc Last edited by Roman on 16 Aug 2026, 14:03; edited 2 times in total |
|||
|
|
Roman 16 Aug 2026, 14:02
In main loop we do(for redraw Static window)
invoke InvalidateRect, [StaticInfoHwnd],0,1 invoke UpdateWindow,[StaticInfoHwnd] |
|||
|
|
Ali.Z 16 Aug 2026, 20:44
Roman wrote: invoke InvalidateRect, [StaticInfoHwnd],0,1 in general erasing bkgnd is very expensive operation, it is the root cause for flickering. _________________ Asm For Wise Humans |
|||
|
|
Roman 17 Aug 2026, 06:15
This variant not have flickering.
I tested. Work good. |
|||
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2026, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.