Problem with SHFileOperation

R

RichardF

I have a simple function to copy a file.

If I call this with the following paramerters...

psFrom = C:\12345678901234567890.abc
psTo = C:\12345678901234567890.xyz.abc

The TO file ends up being C:\12345678.abc

Any ideas?

Thankd

RichardF

Here is the function...






Public Function DoFileCopy(psFrom As String, _
psTo As String, _
Optional piFlags As Integer =
FOF_NOCONFIRMATION +_
FOF_SILENT +_

FOF_FILESONLY) As Long
Dim FileOp As tSHFILEOPSTRUCT
Dim lRet As Long


lRet = clErcOK
On Error GoTo AnError
With FileOp
.wFunc = FO_COPY
.pFrom = psFrom
.pTo = psTo
.fFlags = piFlags + FOF_ALLOWUNDO
End With
lRet = SHFileOperation(FileOp)
DoFileCopy = lRet
Exit Function
AnError:
DoFileCopy = Err.Number
End Function
 
C

Chris Dunaway

I have a simple function to copy a file.

If I call this with the following paramerters...

I don't know why your filename is being mangled, but is there any reason
you're not using the classes in the System.IO namespace?

Imports System.IO

File.Copy(psFrom, psTo)

--
Chris

dunawayc[AT]sbcglobal_lunchmeat_[DOT]net

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
 
R

RichardF

Oops, wrong newsgroup!

Sorry, this is an old project using VB 6.

My apologies!



I have a simple function to copy a file.

If I call this with the following paramerters...

I don't know why your filename is being mangled, but is there any reason
you're not using the classes in the System.IO namespace?

Imports System.IO

File.Copy(psFrom, psTo)

--
Chris

dunawayc[AT]sbcglobal_lunchmeat_[DOT]net

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top