
Quote: Originally Posted by
techman41973
Miles, from what I recall, I had issues with Filecopy that I couldn't resolve.
I just changed my code to use Filecopy again and for now it seems to be working, so I may stick with it.
Regarding your second bit of advice on using ShellFilecopy,
"You need to make a string compatible with LPCTSTR type that has a double zero a the end."
If this is truly the problem, why am I getting this error only occasionally?
And how would a string mismatch trigger a "file to large" error
Thanks again
The error may really mean the file path is too long. You are calling the ANSI version of the function. Meaning max path is like 260 characters. The erratic behavior is right in line with this type of error. If there happens to be a double zero in memory after the file path before it exceeds 260 characters you may not get the error. Have you checked the output file names for funky characters hanging on the end?
I haven't done that much VB but there must be a method to fill a buffer with zeroes. Then copy a string into it and use the address so that it's guaranteed to have at least 2 zeroes at the end of the string.
When there's a warning like that on the API docs, that's almost always the problem. I don't think VB strings by default have 2 zeroes at the end.