flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
revolution
I presume you could copy each of the related members from LOGFONT into the CHARFORMAT structure?
A quick glance shows me: lfFaceName <=> szFaceName lfCharSet <=> bCharSet lfHeight <=> yHeight etc. |
|||
![]() |
|
DuXeN0N
revolution wrote: I presume you could copy each of the related members from LOGFONT into the CHARFORMAT structure? How can I do this? I am beginner) |
|||
![]() |
|
pal
mov eax, value in logfont
mov value in logfont, eax e.g. Code: mov eax,lfFaceName mov szFaceName,eax |
|||
![]() |
|
DuXeN0N
okey. and the last question, how can I change font in EDIT from LOGFONT? What struct should I use for EDIT?
|
|||
![]() |
|
DuXeN0N
I tried to copy each of the related members from LOGFONT into the CHARFORMAT but an error occured:
operand sizes do not match. code: invoke ChooseFont,cf mov [lf],eax mov [chf.cbSize],sizeof.CHARFORMAT mov eax,lf.lfHeight mov [chf.yHeight],eax mov eax,lf.lfFaceName mov [chf.szFaceName],eax invoke SendMessage,[hRichEdit],EM_SETCHARFORMAT,SCF_SELECTION,0 jmp .finish and one question. how can I copy BYTE lfItalic; BYTE lfUnderline; BYTE lfStrikeOut; to CHARFORMAT DWORD dwEffects; |
|||
![]() |
|
pal
Try something like (not tested as I aint making a RTB):
Code: mov [cf.lStructSize],sizeof.CHOOSEFONT mov [cf.Flags],CF_INITTOLOGFONTSTRUCT mov [cf.lpLogFont],lf invoke ChooseFont,cf test eax,eax je codeEnd mov eax,[lf.lfHeight] mov [chf.yHeight],eax mov eax,[lf.lfFaceName] mov [chf.szFaceName],eax mov [chf.dwEffects], invoke SendMessage,[hRichEdit],EM_SETCHARFORMAT,SCF_SETSELECTION,chf codeEnd: ret Your code is completely wrong. ChooseFront doesn't return a structure. You pass a pointer to a structure and it fills the items. If you set the flags to CF_INITTOLOGFONTSTRUCT and lpLogFont is a pointer to an initalised LOGFONT structure, it will fill that for you. For the dwEffects, just check the value of each of the members of LOGFONT, and if they are set then or the corresponding value with the CHARFORMAT (CFE_BOLD, CFE_ITALIC, CFE_UNDERLINE etc.). |
|||
![]() |
|
DuXeN0N
pal wrote: Try something like (not tested as I aint making a RTB): mov eax,[lf.lfFaceName] operand sizes do not match |
|||
![]() |
|
pal
Move it to ax or use movzx then.
|
|||
![]() |
|
revolution
lfFaceName is a pointer to a string. You need to copy all of the bytes. That is, you need multiple mov instructions to do it (or maybe rep movs).
|
|||
![]() |
|
pal
Oops yeah, my bad. I aint gonna update my code as its pretty easy to do.
|
|||
![]() |
|
DuXeN0N
can Tomasz Grysztar give me example of RichEdit with ChoseFont Dialog?
|
|||
![]() |
|
habran
Hi DuXeN0N,
You can find all you need for RichEditor here: http://board.flatassembler.net/topic.php?t=9144 You can find ChooseFont in FormatFonts.asm file happy fasming _________________ down under |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.