I'm creating a logfile interpreter program that consists of two editboxes. The first editbox contains the original logfile code, and the second editbox contains the equivalent code of the first editbox in user-readable format. All I want to do now is, everytime I select or highlight a specific code in the first editbox, the equivalent code in the second editbox should be highlighted automatically. Does anyone here knows or have an idea on how to do that?

SetSel() will highlight a certain text on an editbox and GetSel() will get the higlighted text on an editbox (the start and end position). I think this will solve my problem, but I don't know how to use those on a dialog having 2 edit boxes. I've created a button that will highlight a certain text in editbox2 based on the highlighted text in editbox1 but I don't know how to code it. Does anyone can give me a sample code for getting the highlighted text in editbox1 using GetSel() and highlight a text in editbox2 using SetSel()?

1) get the text from box1 into a string object
2) get the text from box2 into another string object
3) search text from box2 to see if it contains the text in box1
4) if found, highlight the text in box2

I think your suggestion is not applicable since the content of the two edit boxes are completely different. The first edit box is consist of numerical codes (, 1) and the second edit box contains the equivalent of the numerical code in user readable format (root.user.image.format, black).

I suppose first you will have to figure out how to translate the numerical format in edit box #1 into the format contained in edit box #2. I have no idea how you would do that.

I already done the conversion from numerical codes to user-readable equivalent. I've created a database wherein the system consults in it for every conversion process. After the conversion, that is the only time where the highlighting feature takes place.

Here is my code... It`s just a sample code since I didn't code it yet in the actual program. I only created a different program just to test my codes.

I've created two buttons, the first button assigns a value to the two edit boxes, and the other button highlights a text in the first edit box. My code doesn't work, do I made a mistake on my code?

void CEditBoxDlg::OnText() 
	// TODO: Add your control notification handler code here
	m_Edit1 = "the quick brown fox jumps over the lazy dog";
	m_Edit2 = "the quick brown fox jumps over the lazy dog";

void CEditBoxDlg::OnHighlight() 
	// TODO: Add your control notification handler code here
	((CEdit*)GetDlgItem(IDC_EDIT1))->SetSel(0, 2);

You have to set the focus to edit1 before calling SetSel()

CEdit* pEdit = ((CEdit*)GetDlgItem(IDC_EDIT1));
pEdit->SetSel(0, -1); // select everything

Thanks for the reply Ancient Dragon... It is now working :)
So all I need to add is a SetFocus().

What event handler should I use to highlight all the text in a edit box, when i click on it? I dont want to use buttons but the text boxes does not have OnBnClicked event.
i just want the text to be ready for editing when i click on it.