'textbox replace text
'   在文本框中当前所选内容替换成指定的文本。
'   hWndControl: 控件的句柄 (例如  HWND_FORM1_TEXTBOX1)
'   TheText:     替换的文本
Sub FF_TextBox_ReplaceText (ByVal hWndControl As HWND, ByRef TheText As CWSTR )
    
    '检查窗口句柄是否有效
    If IsWindow(hWndControl) Then  
       ' Replace the selection.
         SendMessageW hWndControl, EM_REPLACESEL, True, Cast(LPARAM, StrPtr(TheText))
    End If  
    
End Sub

