| | |
Copy a Folder
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Feb 2009
Posts: 6
Reputation:
Solved Threads: 0
•
•
•
•
Here's the MSDN page for SHFileOperation. At the bottom of the page are all the error-codes (return values). So what value does it return in your case?
Print out the value of 'n' in the else statement to find out and thus find out what went wrong.
Yes, as your advice, i add the output of "n",
the result is "1026".(it should be 0x402)
By the MSDN:
0x402 An unknown error occurred. This is typically due to an invalid path in the source or destination. This error does not occur on Windows Vista and later.
So i guess the fail may from the "invalid path". is it right?
(But in my PC, the path is true, with out any problem.)
Could you help me and give me some suggestions?
•
•
Join Date: Nov 2007
Posts: 978
Reputation:
Solved Threads: 208
•
•
•
•
Yes, as your advice, i add the output of "n",
the result is "1026".(it should be 0x402)
By the MSDN:
0x402 An unknown error occurred. This is typically due to an invalid path in the source or destination. This error does not occur on Windows Vista and later.
So i guess the fail may from the "invalid path". is it right?
(But in my PC, the path is true, with out any problem.)
pFrom and pTo members need to be double-null terminated, see the SHFILEOPSTRUCT Structure documentation.
•
•
Join Date: Feb 2009
Posts: 6
Reputation:
Solved Threads: 0
Thank you so much for your advice.
The problem is solved.
I have add a "\0" to the end of the string, which should be a double null terminated(i think).
anyway, here is the solution:
The problem is solved.
I have add a "\0" to the end of the string, which should be a double null terminated(i think).
anyway, here is the solution:
C++ Syntax (Toggle Plain Text)
std::string testto = "d:\\testto" SHFILEOPSTRUCT sf; memset(&sf,0,sizeof(sf)); sf.hwnd = 0; sf.wFunc = FO_COPY; sf.pFrom = "d:\\testfrom"; char d_te[] = "\0"; std::string to = testto; to.append(d_te); sf.pTo = (LPCSTR) to.c_str(); sf.fFlags = FOF_NOCONFIRMATION | FOF_NOCONFIRMMKDIR | FOF_NOERRORUI | FOF_SILENT;
![]() |
Similar Threads
- Lost folder in Outlook 2003 (Windows Software)
- Copy Folder with %Computername% and %Username% prefix (Visual Basic 4 / 5 / 6)
- Folder Settings (Windows NT / 2000 / XP)
- Data Error (CRC) with a folder (Windows NT / 2000 / XP)
- Can I move ALL my Applications folder from one hard drive to another? (IT Professionals' Lounge)
- duplication of picture when trying to copy paste (Windows NT / 2000 / XP)
- Ditto (OS X)
- Copy Files and Folders to CDs (Windows tips 'n' tweaks)
- xp Picture folder (Windows NT / 2000 / XP)
- Saving Address book and Messages in Outlook Express (Windows NT / 2000 / XP)
Other Threads in the C++ Forum
- Previous Thread: What is wrong?..!
- Next Thread: How to use an array element in if-statement?
| Thread Tools | Search this Thread |
api array arrays based beginner binary bitmap c++ c/c++ calculator char char* class code coding compile compiler console conversion count data database delete deploy developer dll download dynamiccharacterarray email encryption error file forms fstream function functions game getline givemetehcodez graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linker list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference rpg sorting string strings struct temperature template text text-file tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets





