Private Function IsDelimiter(ByVal Char As Byte) As Boolean
    Dim S As String
    
    S = Chr(Char)
    IsDelimiter = False
    If S = " " Or S = "," Or S = "." Or S = "?" Or S = vbCr Or S = vbLf Or S = "/" Or S = "\" Or S = "(" Or S = ")" Or S = "[" Or S = "]" Or S = "*" Then
        IsDelimiter = True
    End If
End Function
Private Function GetWord(ts As String, pos As Long) As String
    Dim bArr() As Byte, pos1 As Integer, pos2 As Integer, i As Integer
    
    bArr = StrConv(ts, vbFromUnicode)
    pos1 = 0: pos2 = UBound(bArr)
    
    For i = pos - 1 To 0 Step -1
        If IsDelimiter(bArr(i)) Then
            pos1 = i + 1
            Exit For
        End If
    Next
    
    For i = pos To UBound(bArr)
        If IsDelimiter(bArr(i)) Then
            pos2 = i - 1
            Exit For
        End If
    Next
    
    If pos2 > pos1 Then
        ReDim bArr2(pos2 - pos1) As Byte
        For i = pos1 To pos2
            bArr2(i - pos1) = bArr(i)
        Next
    
        GetWord = StrConv(bArr2, vbUnicode)
               
    Else
        GetWord = ""
    End If
End Function
Private Sub Timer1_Timer()
Call PutWindowOnTop(form1)
GetCursorPos z            ' 得到坐标
Dim X1 As Integer, Y1 As Integer
X1 = z.x0 * Screen.TwipsPerPixelX
Y1 = z.y0 * Screen.TwipsPerPixelY If X1 + Me.Width > Screen.Width Then X1 = X1 - Me.Width + 2000  If Y1 + Me.Height + 200 > Screen.Height Then Y1 = Y1 - Me.Height - 300
form1.Move X1 + 200, Y1 + 200
GetCursorPos z            ' 得到坐标
Dim X2 As Integer, Y2 As Integer
X2 = z.x0 * Screen.TwipsPerPixelX
Y2 = z.y0 * Screen.TwipsPerPixelY
If X2 + Me.Width > Screen.Width Then X2 = X2 - Me.Width + 2000  If Y2 + Me.Height + 200 > Screen.Height Then Y2 = Y2 - Me.Height - 300
  
If X2 - X1 > 3 Or X1 - X2 > 3 Or Y1 - Y2 > 3 Or Y2 - Y1 > 3 Then
form1.Visible = False
End If
If main.WindowState = 0 Then
  Unload form1
 main.Command1.Enabled = True
MsgBox "屏幕取词已关闭 "
End IfEnd Sub