The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: alpha on December 23, 2004, 10:35:03 AM

Title: editing edit controls
Post by: alpha on December 23, 2004, 10:35:03 AM
how? e.g. different fonts, sizes etc.
I can only find code in C++.
Title: Re: editing edit controls
Post by: hutch-- on December 23, 2004, 11:48:17 AM
MASM32 project has a complete rich edit control as an editor. The normal messages for an edit control are documented in win32.hlp where you can set text, get text and set fonts to the edit control.
Title: Re: editing edit controls
Post by: donkey on December 23, 2004, 12:52:55 PM
You must first create a font using CreateFont then send the edit control a WM_SETFONT message. For example...

.data
Courier_New_10 LOGFONT <-13,0,0,0,400,0,0,0,0,3,2,1,49,"Courier New">

.code
invoke CreateFontIndirect,offset Courier_New_10
mov [hFont],eax

invoke SendMessage,[hEdit],WM_SETFONT,[hFont],TRUE


When you no longer need the font use DeleteObject to destroy it. In this case I used CreateFontIndirect that allows you to store the complete font structure in memory however the parameters are the same for CreateFont. In order to fill the structure, if you use RadASM you can use the FontBuilder plugin and it will automatically insert the filled structures based on a font you choose.