@@ -68,9 +68,6 @@ Attribute VB_PredeclaredId = True
68
68
Attribute VB_Exposed = False
69
69
Option Explicit
70
70
71
- Private Sub aaa_Click ()
72
-
73
- End Sub
74
71
75
72
Private Sub Form_Load ()
76
73
Set goFS = New pFileSystemObject
@@ -116,7 +113,7 @@ End Sub
116
113
117
114
Private Sub mnupFileSystemObject_CreateFolder_Click ()
118
115
Dim strFolderPath As String
119
- strFolderPath = InputBox("Enter the Folder path" , Me.mnupFileSystemObject_CreateFolder.Caption, "c:\temp" )
116
+ strFolderPath = InputBox("Enter the Folder path" , Me.mnupFileSystemObject_CreateFolder.Caption, "c:\temp\a\b\c " )
120
117
With Me.txtMain
121
118
goFS.CreateFolder strFolderPath
122
119
.Text = "CreateFolder:" & vbTab
@@ -130,7 +127,7 @@ End Sub
130
127
131
128
Private Sub mnupFileSystemObject_FileExists_Click ()
132
129
Dim strFilePath As String
133
- strFilePath = InputBox("Enter the file path" , Me.mnupFileSystemObject_FileExists.Caption, App.Path & "\modFsDeclare.bas" )
130
+ strFilePath = InputBox("Enter the file path" , Me.mnupFileSystemObject_FileExists.Caption, Me.GetCurrDirFristFile )
134
131
With Me.txtMain
135
132
.Text = "FileExists:" & vbTab & goFS.FileExists(strFilePath) & vbCrLf
136
133
End With
@@ -146,9 +143,9 @@ Private Sub mnupFileSystemObject_FolderExists_Click()
146
143
End Sub
147
144
148
145
Private Sub mnupFileSystemObject_GetFile_Click ()
149
- Dim strFilePath As String
150
- strFilePath = InputBox( "Enter the file path" , Me.mnupFileSystemObject_GetFile.Caption, App.Path & "\modFsDeclare.bas" )
151
- Dim oFile As pFile
146
+ Dim oFolder As pFolder
147
+ Dim oFile As pFile , strFilePath As String
148
+ strFilePath = InputBox( "Enter the file path" , Me.mnupFileSystemObject_GetFile.Caption, Me.GetCurrDirFristFile)
152
149
Set oFile = goFS.GetFile(strFilePath)
153
150
If oFile.IsObjReady = True Then
154
151
With Me.txtMain
@@ -160,8 +157,26 @@ Private Sub mnupFileSystemObject_GetFile_Click()
160
157
Else
161
158
MsgBox "oFile.IsObjReady = " & oFile.IsObjReady, vbCritical, Me.mnupFileSystemObject_GetFile.Caption
162
159
End If
160
+
163
161
End Sub
164
162
163
+
164
+ Public Function GetCurrDirFristFile () As String
165
+ Dim oFolder As pFolder , objFile As Object , oFile As pFile
166
+ Set oFolder = goFS.GetFolder(App.Path)
167
+ GetCurrDirFristFile = ""
168
+ If oFolder.IsObjReady = True Then
169
+ For Each objFile In oFolder.Files
170
+ If Not objFile Is Nothing Then
171
+ Set oFile = New pFile
172
+ Set oFile.Obj = objFile
173
+ GetCurrDirFristFile = oFile.Path
174
+ Exit For
175
+ End If
176
+ Next
177
+ End If
178
+ End Function
179
+
165
180
Private Sub mnupFileSystemObject_GetFolder_Click ()
166
181
Dim strDirPath As String
167
182
strDirPath = InputBox("Enter the folder path" , Me.mnupFileSystemObject_GetFolder.Caption, App.Path)
@@ -182,7 +197,7 @@ End Sub
182
197
183
198
Private Sub mnupTextStream_ReadFile_Click ()
184
199
Dim strFilePath As String , strLine As String
185
- strFilePath = InputBox("Input file path" , Me.mnupTextStream_ReadFile.Caption, App.Path & "\modFsDeclare.bas " )
200
+ strFilePath = InputBox("Input file path" , Me.mnupTextStream_ReadFile.Caption, App.Path & "\README.cmd " )
186
201
Dim oTextStream As pTextStream
187
202
Set oTextStream = goFS.OpenTextFile(strFilePath, pIOMode.ForReading, True )
188
203
If goFS.LastErr <> "" Then
0 commit comments