I can’t see any point to using a timer or a thread, so I created a simple MASM32 In Memory dialog example that draws text on the client are of the dialog window.
;==============================================================================
include \masm32\include\masm32rt.inc
;==============================================================================
IDC_SHOW equ 1000
IDC_HIDE equ 1001
;==============================================================================
.data
hFont dd 0
fShow dd 0
str1 db "my other brother darryl",0
.code
;==============================================================================
;------------------------------------------------------------------
; This is a modification of the MakeFont procedure from the MASM32
; examples, with the height and width specifications replaced with
; a point size specification.
;------------------------------------------------------------------
MakeFont proc pointSize:dword,weight:dword,italic:dword,lpFontName:dword
invoke GetDC, 0
invoke GetDeviceCaps, eax, LOGPIXELSY
mul pointSize
xor edx, edx
mov ecx, 72
div ecx
invoke CreateFont,eax,0,NULL,NULL,weight,italic,NULL,NULL,
DEFAULT_CHARSET,OUT_TT_PRECIS,CLIP_DEFAULT_PRECIS,
PROOF_QUALITY,DEFAULT_PITCH or FF_DONTCARE,
lpFontName
ret
MakeFont endp
;==============================================================================
IDC_SHOW equ 1000
IDC_CLEAR equ 1001
;==============================================================================
DlgProc proc uses ebx hwndDlg:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
LOCAL ps:PAINTSTRUCT, rc:RECT, hdc:HDC
SWITCH uMsg
CASE WM_INITDIALOG
invoke MakeFont, 24, FW_NORMAL, TRUE, chr$("Arial Narrow")
mov hFont, eax
CASE WM_PAINT
invoke BeginPaint, hwndDlg, ADDR ps
invoke SetTextColor, ps.hdc, 000000ffh
invoke SelectObject, ps.hdc, hFont
push eax
.IF fShow
invoke SetBkMode, ps.hdc, TRANSPARENT
invoke TextOut, ps.hdc, 42, 50, ADDR str1, SIZEOF str1 - 1
.ENDIF
pop eax
invoke SelectObject, ps.hdc, eax
invoke EndPaint, hwndDlg, ADDR ps
CASE WM_COMMAND
SWITCH wParam
CASE IDC_SHOW
mov fShow, 1
invoke InvalidateRect, hwndDlg, NULL, TRUE
CASE IDC_HIDE
mov fShow, 0
invoke InvalidateRect, hwndDlg, NULL, TRUE
CASE IDCANCEL
invoke EndDialog, hwndDlg, 0
ENDSW
CASE WM_CLOSE
invoke DeleteObject, hFont
invoke EndDialog, hwndDlg, 0
ENDSW
return 0
DlgProc endp
;==============================================================================
start:
;==============================================================================
Dialog "Test", "MS Sans Serif",10, \
WS_OVERLAPPED or WS_SYSMENU or DS_CENTER, \
2,0,0,150,100,1024
DlgButton "&Show",WS_TABSTOP,35,60,25,10,IDC_SHOW
DlgButton "&Hide",WS_TABSTOP,85,60,25,10,IDC_HIDE
CallModalDialog 0,0,DlgProc,0
exit
;==============================================================================
end start