The MASM Forum

General => The Campus => Topic started by: xandaz on October 27, 2021, 01:58:10 AM

Title: CHARFORMAT2A works but CHARFORMAT2W doesnt. Is there a reason for this?
Post by: xandaz on October 27, 2021, 01:58:10 AM
    Hi guys. I'm using CHARFORMAT2A instead of CHARFORMAT2W. CHARFORMAT2W doesn't seem to work. Any ideas?            invoke  ClearMemory,esi,sizeof CHARFORMAT2
            invoke  ClearMemory,addr chFont,sizeof chFont
            invoke  ClearMemory,addr LogFont,sizeof LogFont
            push    hInstance
            pop     chFont.hInstance
            invoke  SendMessage,hMdi,WM_MDIGETACTIVE,0,0
            mov     chFont.hwndOwner,eax
            invoke  GetDC,[edi].hEdit
            mov     chFont.hDC,eax
            mov     chFont.lStructSize,sizeof CHOOSEFONT
            mov     chFont.lpLogFont,offset LogFont
            mov     chFont.nFontType,SCREEN_FONTTYPE
            invoke  ChooseFont,addr chFont
            invoke  GetDeviceCaps,chFont.hDC,LOGPIXELSY
            mov     ebx,chFont.iPointSize;           
            xor     edx,edx
            mul     ebx
            mov     ebx,72
            xor     edx,edx
            div     ebx
            mov     [esi].cbSize,sizeof CHARFORMAT2A
            mov     [esi].yHeight,eax
            push    LogFont.lfWeight
            pop     [esi].wWeight
            mov     [esi].dwMask,CFM_COLOR or CFM_FACE or CFM_SIZE or CFM_WEIGHT
            mov     [esi].crTextColor,0ah
            mov     al,LogFont.lfCharSet
            mov     [esi].bPitchAndFamily,al
            mov     [esi].bCharSet,DEFAULT_CHARSET
            invoke  UnicodeToANSI,addr LogFont.lfFaceName,addr [esi].szFaceName
            invoke  SendMessageA,[edi].hEdit,EM_SETCHARFORMAT,SCF_ALL,esi
            invoke  ReleaseDC,[edi].hEdit,chFont.hDC