Hello Lenin,

selecting something into a device context doesn't mean that windows will then do any updates automatically. The windows API is not a HLL, you must do everything on your own.

What your code fragments tell me is that you are currently learning both programming in win32 and programming in MASM. This by itself is not easy, but then you shouldn't make things even harder by beginning your efforts with GDI and font stuff, which surely isn't the easiest part of the windows API.
Posted on 2005-09-25 02:24:42 by japheth
Not to sound rude or ungratefull but I wonder if someone can actually tell me how to correct the problem...

I got tile here:
WndProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
    .if uMsg==WM_CREATE
        ; (...)
        invoke GetStockObject, DEFAULT_GUI_FONT
        mov  g_hfFont, eax

    ; (...)
    .elseif uMsg==WM_PAINT
    invoke BeginPaint, hwnd, addr ps
    invoke SelectObject, eax, g_hfFont
    invoke EndPaint, hwnd, addr ps
    ; (...)
WndProc endp

DoSelectFont proc
    LOCAL cf:CHOOSEFONT, lf:LOGFONT

    invoke RtlZeroMemory, addr cf, sizeof cf
   
    mov  cf.lStructSize, sizeof cf
    push hwnd
    pop  cf.hwndOwner
    lea  ebx, lf
    mov  cf.lpLogFont, ebx
    push g_rgbText
    pop  cf.rgbColors
    mov  cf.Flags, CF_EFFECTS or CF_INITTOLOGFONTSTRUCT or CF_SCREENFONTS

invoke ChooseFont, addr cf
.if eax != 0
    invoke CreateFontIndirect, addr lf
    .if eax != NULL
        mov g_hfFont, eax
    .endif
    push cf.rgbColors
    pop g_rgbText
.endif
xor eax, eax
ret
DoSelectFont endp


Do I need to send a WM_SETFONT message? Or what?
Posted on 2005-09-25 15:49:37 by Lenin