You can use SetCtrlAttribute to select text with ATTR_TEXT_SELECTION_START and ATTR_TEXT_SELECTION_LENGTH. The text will then be highlighted when (and only when) the text box is the active control.
SetCtrlAttribute (panelHandle, PANEL_TEXTBOX, ATTR_TEXT_SELECTION_START, selectionStart);
SetCtrlAttribute (panelHandle, PANEL_TEXTBOX, ATTR_TEXT_SELECTION_LENGTH, selectionLength);
SetActiveCtrl (panelHandle, PANEL_TEXTBOX);
Look at the attached sample project.