hi friends,

i would like to know how to highlight text in dialog's Edit box and List box.
Is there any mfc api for that ??

Why not? Do you forget GDI+?

i found the solution for highlighting text

1. SetFocus()
2. SetSel()

but i want to highlight multiple word ....can anybody help...

Great! Hightlight = Text selection.

Selecting word is fine in my case can u help me for multiple selection i dont want go inside of gdi+

multiple selection - Text, List Items?

For example string in editbox is - Hi this is ashish!

and i want to select "is" and setsel() function takes position of start and end char to be selected.

m_CtlEdit.SetFocus()
m_CtlEdit.SetSel(5,7)
this is selecting first "is" - Hi this is ashish!

like that i tried for next
m_CtlEdit.SetSel(8,10)

but i want to select both "is" in same time..

Is it HideSelection?

if i do
m_CtlEdit.SetFocus()
m_CtlEdit.SetSel(5,7)
m_CtlEdit.SetSel(8,10)

then it is selecting the last one not both

It show the selection and make it permanent.

obj.HideSelection(FALSE, TRUE);

this function is used for RichEditbox not for edit box

set ES_NOHIDESEL style.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.