请问如何获得一个文件的状态,如是否被其它程序运行?因为我在程序中要删除一个文件,但当这个文件在运行的时候就不能删除了,所以我想在事先的时候就获得这个文件的状态,请问如何获得?
解决方案 »
- 请教关于Mscomm的ComEvReceive处理的问题
- 求教。添加记录提示主键种内容相同怎么写?
- 假设在vb6中求得了一个数据a,大家都是采用什么方法将a通过internet放入远程服务器中个人建立的数据库mydb.mdb中的。mydb.mdb是access数
- 高分请教,谁知道怎么在VB中控制摄影头。
- 请问大家这是什么控件?
- 我们这里的农村村庄都在进村子的路口留人把守,一有“生人”必须拦截上报,违者责任重大。谁之过?
- 谁能详解一下DerectXPlay传输数据的步骤?
- VB6如何生成二维码
- 使用printer.paintpicture的话,如何实现预览?
- callbyname & usercontrol
- 如何利用WINDOWS下的TELNET功能,访问网络设备?请求大家帮助!
- VB中有什么好的对象存放数据比较方便?最好类似于recordset.
private sub ...
if FileInUse("file name") then
msgbox "File is in use!"
else
...
end if
end subPublic Function FileInUse(path$) As Boolean
Dim X
X = FreeFile ''''get free file # On Error Resume Next
Open path$ For Input As X
If err = 0 Then
FileExists = True
Else
FileExists = False
End If
Close XEnd Function
''try :private sub ...
if FileInUse("file name") then
msgbox "File is in use!"
else
...
end if
end subPublic Function FileInUse(path$) As Boolean
Dim X
X = FreeFile ''''get free file # On Error Resume Next
Open path$ For Input As X
If err = 0 Then
FileInUse= True
Else
FileInUse= False
End If
Close XEnd Function
http://www.china-askpro.com/msg6/qa35.shtml