Case 18 'btnPaste
If TextEdit.SelectionStart > -1 Then
i = TextEdit.SelectionStart
If TextEdit.SelectionLength > 0 Then 'The pasted text should replace the selection.
TextEdit.Text = StrRemove(TextEdit.Text,i,TextEdit.SelectionLength)
End If
If cPPC Then 'Paste from the clipboard on the device
s = clip.GetClipboardData
Else 'Paste from the global variable on the desktop
s = DesktopString
End If
TextEdit.Text = StrInsert(TextEdit.Text,i,s)
TextEdit.SelectionStart = i + StrLength(s)
TextEdit.ScrollToCaret
' TextEdit.Focus
' Hardware.KeyDown(17)
' hardware.KeyPress(Asc("V"))
' hardware.KeyUp(17)
End If