loudogz
asked on
SHFileOperation and SHFILEOPSTRUCT problem
windows nt 4.0
I'm trying to copy a bunch of folders and files under a directory to some destination...eg:
CString strSource, strDestination;
strSource = "d:\\lou\\some area\\*.*;
strDestination = "d:\\SomeDestination";
SHFILEOPSTRUCT oshf;
oshf.pFrom = strSource;
oshf.pTo = strDestination;
SHFileOperation(&oshf);
This code works....But for some reason when i try this program on another computer with the IE 6.0... It craps out with a return code 1026.
Interesting thing is : if i hardcode the string value to pFrom and pTo.. it works. But for some reason it doesn't like CString...
Thanks in Advance,
Lou
I'm trying to copy a bunch of folders and files under a directory to some destination...eg:
CString strSource, strDestination;
strSource = "d:\\lou\\some area\\*.*;
strDestination = "d:\\SomeDestination";
SHFILEOPSTRUCT oshf;
oshf.pFrom = strSource;
oshf.pTo = strDestination;
SHFileOperation(&oshf);
This code works....But for some reason when i try this program on another computer with the IE 6.0... It craps out with a return code 1026.
Interesting thing is : if i hardcode the string value to pFrom and pTo.. it works. But for some reason it doesn't like CString...
Thanks in Advance,
Lou
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
jkr,
I do this, I just didn't include it to make my post a little shorter.
SHFILEOPSTRUCT oshf;
ZeroMemory ( &oshf, sizeof ( oshf));
thanks,
lou
I do this, I just didn't include it to make my post a little shorter.
SHFILEOPSTRUCT oshf;
ZeroMemory ( &oshf, sizeof ( oshf));
thanks,
lou
ASKER
roshman,
Can I pass a CString value to that this function sprintf(szPATH, "C:\\Old Watch\\*.txt"); instead of hardcoding "C:\\Old Watch\\*.txt" .... because I don't know the value it changes.... Another thing is that I know about this:
"pFrom, pTo
Each file name must be terminated by a single NULL character. An additional NULL character must be appended to the end of the final name to indicate the end of pFrom. "
But for some reason I'm having a hard time working with CString and adding double null character....
Thanks,
Lou
Can I pass a CString value to that this function sprintf(szPATH, "C:\\Old Watch\\*.txt"); instead of hardcoding "C:\\Old Watch\\*.txt" .... because I don't know the value it changes.... Another thing is that I know about this:
"pFrom, pTo
Each file name must be terminated by a single NULL character. An additional NULL character must be appended to the end of the final name to indicate the end of pFrom. "
But for some reason I'm having a hard time working with CString and adding double null character....
Thanks,
Lou
Yes,
Like this
CString csYourString; <-- this contains the path
sprintf(szPATH, csYourString);
int nLen = lstrlen(szPATH);
szPATH[nLen] = 0; <------ BOTH THESE
szPATH[nLen+1] = 0; <------ SHOULD BE NULL !!!
Rosh :)
Like this
CString csYourString; <-- this contains the path
sprintf(szPATH, csYourString);
int nLen = lstrlen(szPATH);
szPATH[nLen] = 0; <------ BOTH THESE
szPATH[nLen+1] = 0; <------ SHOULD BE NULL !!!
Rosh :)
ASKER
thanks roshman.... that worked!
SHFILEOPSTRUCT oshf;
ZeroMemory ( &oshf, sizeof ( oshf));
?