Hi There

Someone knows (or have an working example), of an editbox that allows that the text inside it is in colors ? (Without using richedit)....

And also allowing this text to not be erased.

I saw a good example, of isolating and coloruing some strings on a listbox, but i don?t know if it can be done in a editbox...

Also, how to insert an image on a editbox ?

It would be good to have an alternative way for an richedit style, without having to use an richedit control/library.

Best Regards,

Posted on 2004-08-30 12:40:01 by Beyond2000!
u can use WM_CTLCOLOREDIT message
u see:

invoke GetDlgCtrlID,lParam
.if eax == ID_EDIT
invoke SetTextColor, wParam, Blue
invoke SetBkColor, wParam, Black
invoke GetStockObject, BLACK_BRUSH
Posted on 2004-08-30 20:30:55 by benny
Hi Benny

Tks a lot !

It worked, but i was thinking in something more extendable..I mean, something like this:


But insetad displaying the string should be in a listview, it is in a editcontrol, like your code.

Nemo?s code uses a instring function that can ripp some tokes, and surround specific strings by colours.

His string is something like this:

{#000000#}Made by {#FF0000#}NEMO{#0000FF#}!!!!!{#FF00FF#}

Everything in betwen {#XXXXXX#} is related to a certain colour code.

It has a small problem, because the 1st string "Made by" Is not being coloured, but the rest is Ok.

I was wondering if this could be ported to work on a edit bos....And also, colouring it in read-only (As a flag, for example...If 0 it is read only, if 01 is editable ---- But both cases, keeping the color scheme and not the gray stuff in common readonly)

I?m trying to work with your code and with his to see if it can be mixed somehow, but i?m not being able to do that...

Can you take a look at his code, and see if it can be done ?

Best Regards,

Posted on 2004-08-30 21:46:49 by Beyond2000!
hi beyong2000!

i had download the example, but i cant do it in editbox, if u can, please tell me!
Posted on 2004-08-30 22:31:12 by benny
Hi Benny

Sorry for the delay, my code is for RosAsm, and i had to convert it to masm to you see.

It shows both codes, yours and nemo?s.

I modified his code for the dialogs a bit.

It contains his list box and your editbox with coloured text.

I?m trying to combine the two versinos now, but i?m still gotting nothing.

Best Regards,

Posted on 2004-08-31 01:23:09 by Beyond2000!
To keep the colouring for read only, i just needed to change WM_CTLCOLOREDIT to WM_CTLCOLORSTATIC.

Tks comrade :)

Now to the combining of those codes...

Best Regards,

Posted on 2004-08-31 03:23:59 by Beyond2000!
What seems to be needed is put the DRAWITEM function in the WM_CTLCOLOREDIT message.

And then remove the drawitemstruct structure, because it does not allows editboxes..

And then get the coordinated of the editbox to be passed to the CopyRect function, and then use WM_SETTEXT on the sendmessage..

But, how to get the coordinates of the editbox ?

Posted on 2004-08-31 13:44:37 by Beyond2000!
Hi Guys,

I got some result in IWn2000, but stil it don?t work as needed, and it still uses DRAWITEMSTRUCT structure. and also the other for the eit control.

I?ll post the link where you can find the file here, to avoid pollution of the files i?m posting.


Can someone pls, help ?

Best Regards,

Posted on 2004-09-08 11:19:39 by Beyond2000!

i think its a very good example!
Posted on 2004-09-08 22:32:29 by benny
I?m having troubles in identify the handle of the DRAWITEMSTRUC


They belongs to the listbox control, but i can?t find where are the handles of the editcontrol.

If i could be able to find them, maybe it could be possible to pass to those members the handles of the editbox insetad of the lsitbox, and avoid the usage of the WM_DRAWITEM message.

I mean, the main registers and values used when it is under the WM_DRAWITEM, must be the same when it goes to the WM_CTLCOLORSTATIC message.

If all registers and values are preserved and the handle of the listbox exchanges with the one of the editcontrol...it maybe possible to use the editcontrol like that.

Best Regards,

Posted on 2004-09-09 01:42:25 by Beyond2000!