判断当前应用程序目录下是否有一个名字为Client.int的文件(该文件属性为隐藏),如果没有的话建一个这样的文件,并且把属性设置为隐藏的代码如何实现呀???

解决方案 »

  1.   

    Private Sub Form_Load()    Dim strFile As String
        
        strFile = IIf(Right(App.Path, 1) = "\", App.Path, App.Path & "\") & "Client.ini"
        
        If Dir(strFile, vbHidden) = "" Then
            Open strFile For Random As #1
            Close #1
            SetAttr strFile, vbHidden
        End If
        
    End Sub
      

  2.   

    Private Sub Command1_Click()
    Dim FileName As StringFileName = App.Path & "\Client.int"If Dir(FileName, vbHidden) <> "" Then
        MsgBox "已经存在"
    Else
        Open FileName For Output As #1
        Close #1
        SetAttr FileName, vbHidden
    End If
    End Sub