flat assembler
Message board for the users of flat assembler.
Index
> Windows > RichEdit Problems |
Author |
|
revolution 09 May 2009, 11:11
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. |
|||
09 May 2009, 11:11 |
|
DuXeN0N 09 May 2009, 11:33
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) |
|||
09 May 2009, 11:33 |
|
pal 09 May 2009, 12:20
mov eax, value in logfont
mov value in logfont, eax e.g. Code: mov eax,lfFaceName mov szFaceName,eax |
|||
09 May 2009, 12:20 |
|
DuXeN0N 09 May 2009, 12:40
okey. and the last question, how can I change font in EDIT from LOGFONT? What struct should I use for EDIT?
|
|||
09 May 2009, 12:40 |
|
DuXeN0N 10 May 2009, 02:13
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; |
|||
10 May 2009, 02:13 |
|
pal 10 May 2009, 08:36
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.). |
|||
10 May 2009, 08:36 |
|
DuXeN0N 10 May 2009, 08:59
pal wrote: Try something like (not tested as I aint making a RTB): mov eax,[lf.lfFaceName] operand sizes do not match |
|||
10 May 2009, 08:59 |
|
pal 10 May 2009, 09:43
Move it to ax or use movzx then.
|
|||
10 May 2009, 09:43 |
|
revolution 10 May 2009, 09:46
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).
|
|||
10 May 2009, 09:46 |
|
pal 10 May 2009, 12:42
Oops yeah, my bad. I aint gonna update my code as its pretty easy to do.
|
|||
10 May 2009, 12:42 |
|
DuXeN0N 11 May 2009, 04:51
can Tomasz Grysztar give me example of RichEdit with ChoseFont Dialog?
|
|||
11 May 2009, 04:51 |
|
habran 11 May 2009, 12:21
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 |
|||
11 May 2009, 12:21 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.