Hi guys,

I'm stuck on trying to set a richedits font... The control is working and is displayed properly but now I want to set the font to something more easier to look at like Courier New, I could do this easier if the struct wanted a pointer to the font name, but it wants an just a zero terminated string. How do I place a string in the struct instead of a pointer to it?

Below is code that I've been working on. The error that pops up is "invalid instruction operands" which is caused by the offset instruction. I've tryied everything except of course the right way to get it to work.

local cf:CHARFORMAT2
mov cf.cbSize, sizeof cf
mov cf.dwMask, CFM_FACE
mov cf.szFaceName, offset DefFontFace
invoke SendMessage, hwndRichEdit, EM_SETCHARFORMAT, SCF_ALL, addr cf

How come I can't just go something like this :confused:

mov cf.szFaceName, byte ptr [DefFontFace]

Thanks for all the help! :alright:
Posted on 2002-02-06 00:18:18 by JamesE

Just send the message WM_SETFONT with the handle of the font you require to the edit control. You can get the font by either using a stock font or creating a font from a true type font using CreateFont.


Posted on 2002-02-06 05:13:53 by hutch--