|
-
February 1st, 2005, 01:03 PM
#1
SHFileOperation
Here is the code . Everything works fine as long as I use
the char *, but if I use CStrings instead ,in passing the
file names it throws an error. I tried to assign the
allocated CStrings to char pointers but wouldn’t work. It’s
bizarre. Any clues how to convert the CSring to char * and
still make it work.
Thanks,
bool bFailIfExists = false;
char *strTS = "c:\\temp\\msv.txt";
char *strTD = "\\\\MyMachine\\ docs\\msv.txt";
CString strSource("c:\\temp\\msv.txt"), strDest
("\\\\MyMachine\\docs\\msv.txt");
SHFILEOPSTRUCT shop;
ZeroMemory(&shop, sizeof(shop));
shop.hwnd = AfxGetMainWnd()->m_hWnd;
shop.wFunc = FO_COPY;
shop.pFrom = strTS;
shop.pTo = strTD;
shop.fFlags = FOF_NOCONFIRMATION|FOF_SILENT;
if (0 == SHFileOperation(&shop))
{
bool bRet = true;
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|