Dim DBpath
DBpath = "C:\滑动数据库测试.mdb"
Function GetPos(图片名)
Dim DBIndex, TBIndex, arr, i, j, x, y, data, 终点
Dim ValueS, 起点x, 起点y, 终点x, 终点y, x间距, y间距
起点x=240 : 终点x=433
起点y=287 : 终点y=407
x间距=60 : y间距=40
DBIndex = Plugin.LazyOffice.AccDBOpen(DBpath)
TBIndex = Plugin.LazyOffice.AccTBOpen(图片名, DBIndex,"picdata","")
arr = Plugin.LazyOffice.AccTBGetValueArrC("picdata", TBindex, DBindex)
ValueS = Join(arr, ",")
x = ""
Do
If x间距 >= 40 Then
For i = 起点x To 终点x step x间距
For j = 起点y To 终点y Step y间距
Data = i & "," & j & "|" & GetPixelColor(i, j)
// TracePrint data
If InStr(ValueS,Data) = 0 Then
TracePrint i &","& j
x = i
y = j
Exit Do
End If
Next
Next
Else
GetPos = ""
Call 关闭数据库()
Exit Function
End If
x间距 = x间距 - 10
Loop
Rem 标记
终点 = x + 100
If 终点 > 终点x Then
终点 = 终点x
End If
For i = 终点 To x step -1
Data = i & "," & y & "|" & GetPixelColor(i, y)
If InStr(ValueS,Data) = 0 Then
x = i
Exit For
End If
Next
TracePrint "返回坐标为:" & x & "," & y
GetPos = x
Call 关闭数据库()
End Function
Function GetPic()
Dim Data,图片名,pos
For i = 156 To 165
If Data = "" Then
Data = i & "," & 424 & "|" & GetPixelColor(i, 424)
Else
Data = Data & "," & i & "," & 424 & "|" & GetPixelColor(i, 424)
End If
Next
If Plugin.Access.Connect(DBpath, "") = False Then
TracePrint "数据库连接失败"
Exit Function
End If
图片名 = Plugin.Access.SelectData("集合表", "TPName", "picdatas='" & Data & "'")
If 图片名 <> "" Then
pos = InStr(图片名, " ")
图片名 = Left(图片名, pos - 1)
GetPic = 图片名
TracePrint "图片为:" & 图片名 & ",图片长度为:" & len(图片名)
Else
TracePrint "未匹配到数据库的图片数据"
GetPic = ""
Exit Function
End If
TracePrint Plugin.Access.Close & "断开数据库连接"
End Function