Error 1026 Using SHFileOperation - TechRepublic
General discussion
January 25, 2005 at 08:08 PM
icscomputersaz

Error 1026 Using SHFileOperation

by icscomputersaz . Updated 21 years, 5 months ago

I am using SHFileOperation to copy some files from an Install CD to the Target folder. The program works fine on W2K and XP, but under W98, I get a File System Error (1026).
I know that this Function needs to have the Null characters added properly, & I have done so. Any ideas?
Here is the code for reference:

Option Explicit

Const FO_COPY = &H2

Private Type SHFILEOPSTRUCT
hwnd As Long
wFunc As Long
pFrom As String
pTo As String
fFlags As Long
fAnyOperationsAborted As Long
hNameMappings As Long
lpszProgressTitle As String
End Type

Dim destination As String
Dim sOrigin As String
Dim sTarget As String
Dim sDesktopPath As String
Dim sFontsPath As String
Dim sFilePath As String
Dim sMsg As String
Dim sSysRoot As String
Dim sProgramFiles As String

Dim lFileOp As Long
Dim lresult As Long
Dim lFlags As Long
Dim lpil As Long

Dim SHFileOp As SHFILEOPSTRUCT

lFileOp = FO_COPY
sOrigin = App.Path & “\*.*”
sTarget = “C:\247guardian”
sDesktopPath = fGetSpecialFolder(CSIDL_DESKTOPDIRECTORY)
sFontsPath = fGetSpecialFolder(CSIDL_FONTS)
sProgramFiles = fGetSpecialFolder(CSIDL_PROGRAM_FILES)
sSysRoot = fGetSpecialFolder(CSIDL_WINDOWS)

Screen.MousePointer = vbHourglass

With SHFileOp
.wFunc = lFileOp
.pFrom = sOrigin & vbNullChar & vbNullChar
.pTo = sTarget & vbNullChar & vbNullChar
.fFlags = lFlags
.lpszProgressTitle = sFontsPath & vbNullChar & vbNullChar
End With
lresult = SHFileOperation(SHFileOp)

This discussion is locked

All Comments