当我运行一个程序,它就会读取软盘中的"102mm.txt"与程序目录的"mm201.txt"对比,如果一样就启动程序,不一样(或没插入磁盘)就退出.
解决方案 »
- 请教: VB中竟然不能在类中定义一个名为Open的function/sub ?
- 能否一次性将Recordset记录集内的数据添加到SQL中去
- 解救小问题?
- 为什么无法触发MSComm事件?
- 各位大侠,请问在sql server2000中执行"SELECT * INTO [;DATABASE=c:\db2.mdb].BK_T1 FROM T1"语句会出错?
- vb.net(2003)中,怎么ListView显示多列数据
- 关于ADO问题,请问我的机器上是2.1,有新的原程序代码是ADO library 2.6,运行在我的开发环境上引用中就有missing ADO Library 2.6,我该怎么获得ADO 2.6呢?请指教!
- to uguess(uguess): 这是谢你的!
- sql语句0——''
- 请高手指点有关动态链接库的问题?!
- 请问怎样做补丁程序?
- 很难的API调用,看来只有高手才能搞定 capFileSaveDIB参数有错吗?
s1=读取软盘中的"102mm.txt" '这个会吧。
s2=读取程序目录的"mm201.txt"
if s1<>s2 then end
exit sub
lin:
msgbox err.description
If CompFile("a:\102mm.txt", App.Path + "\mm201.txt") = False Then
End
End If
End Sub
Private Function CompFile(ByVal file1 As String, ByVal file2 As String) As Boolean
On Error GoTo myerr
CompFile = False
Dim buff1() As Byte
Dim l1 As Long
l1 = FileLen(file1)
ReDim buff1(l1 - 1)
Open file1 For Binary Access Read As #1
Put #1, , buff1
Close #1
Dim s1 As String
s1 = StrConv(buff1, vbUnicode)
Dim buff2() As Byte
Dim l2 As Long
l2 = FileLen(file2)
ReDim buff1(l2 - 1)
Open file2 For Binary Access Read As #1
Put #1, , buff2
Close #1
Dim s2 As String
s2 = StrConv(buff2, vbUnicode)
Dim a As Boolean
a = StrComp(s1, s2, vbBinaryCompare)
CompFile = Not a
Exit Function
myerr:
CompFile = False
End Function