|
just a question, are these menu item are mapped with correct function!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/xml>
|
|
|
|
|
Did you set functions for them correctly?
|
|
|
|
|
Hi All
How can i copy folder tree?I have source and destination address.Plz help me
|
|
|
|
|
Use the SHFileOperation() function.
|
|
|
|
|
I am useing this code for copy.It's working for File.Then I am geting Error No.5
Access is denied.
CString source[100];
int path;
CString destination = _T("C:\\");
destination += PathFindFileName(source[path]);
if ( !CopyFile(source[path],destination , TRUE))
{
DWORD dwError = GetLastError();
CString szMsg;
szMsg.Format(_T("Error number), dwError);
AfxMessageBox(szMsg);
}
else
{
AfxMessageBox(_T("Success"));
}
modified on Tuesday, September 30, 2008 4:13 AM
|
|
|
|
|
You cannot use CopyFile to copy content of a folder.. Other wise you have to copy all the files in folder one by one..
|
|
|
|
|
Ok Sir So can you give me some example code.
Plz help me
Thanks in advance
|
|
|
|
|
|
After that i managed to write a code of SHFileOperation.Plz check it's right or not.
BOOL CopyFolder (LPCTSTR pFrom,LPCTSTR pTo)
{
HRESULT hr;
SHFILEOPSTRUCT sfo;
ZeroMemory(&sfo,sizeof(sfo));
sfo.hwnd = NULL;
sfo.wFunc = FO_COPY;
sfo.pFrom = pFrom;
sfo.pTo = pTo;
sfo.fFlags = FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOCONFIRMMKDIR;
hr = SHFileOperation(&sfo);
return (SUCCEEDED(hr));
}
Sir i want to call
CopyFolder (LPCTSTR pFrom,LPCTSTR pTo) function in some other function like
StartCopy() So Plz hep me how can i call it.I am new and not abel to call function with parameter.Plz help me
|
|
|
|
|
Suppose you have folder c:\folder1 and you want that drive to move to d:. In this case the CopyFolder should be called as
CopyFolder( _T("C:\\folder1\\*\0"), _T("D:\\folder1\\\0"));
|
|
|
|
|
Thank It's a working for only Directory.It's not copy File which is exit in directory.So plz help me
I am useing this code
int aq;
CString Source[100];
CString Destination;
for(aq=0;aq<10;aq++)
{
Destination = _T("C:\\");
Destination += PathFindFileName(Source[aq]);
HRESULT hr;
SHFILEOPSTRUCT sfo;
ZeroMemory(&sfo,sizeof(sfo));
sfo.hwnd = NULL;
sfo.wFunc = FO_COPY;
sfo.pFrom = Source[aq];
sfo.pTo = Destination;
sfo.fFlags = FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOCONFIRMMKDIR;
hr = SHFileOperation(&sfo);
return (SUCCEEDED(hr));
}
|
|
|
|
|
TeVc++ wrote: Destination = _T("C:\\"); Destination += PathFindFileName(Source[aq]);
I think you should append * in the Destination variable.
<br />
....<br />
Destination = _T("C:\\"); <br />
Destination += PathFindFileName(Source[aq]);<br />
Destination += _T("\\*\0");<br />
.....<br />
|
|
|
|
|
Nothing Change in the out put.Plz help me
|
|
|
|
|
How does the value in the "Source[aq]" looks like?
|
|
|
|
|
Source[aq] looks right.Problem is that it's is copy File also as a directory.So Plz tell me how can solve it.
Plz help me
|
|
|
|
|
Sorry i didn't get you. What do you mean by "File also as a directory" ??
|
|
|
|
|
Ok If i copy this one Source ="C:\test\dump.txt" And destination=D:\.Then copy like this
Out put is
D:\test
D:\dump.txt(Showing like Folder and it's data not Copied).
But i want to copied like this
D:\test\dump.txt
Plz help me
|
|
|
|
|
Sorry My bad.
The source folder to be specifed like "c:\\test\0" ( Previously I said you should specify like "c:\\test\\*\0". This is not needed and that was the problem )
|
|
|
|
|
Sir i am useing this code
CString Destination= _T("C:\\Test\\");
Destination+= PathFindFileName(source[aq]);
Destination+="\\0";
And not working for file copy.it's working for folder copy.It's make a also Folder with name of "0".
Plz help me
|
|
|
|
|
TeVc++ wrote: Destination+="\\0";
only 1 slash is necessry( it is null character \0 )
Destination+="\\0";
Destination+="\0";
|
|
|
|
|
I use this one
Destination+="\0"; But nothing chnage in out put.
Plz help me
|
|
|
|
|
You shouldn't need to use the escape character for back-slashes within a string, should you?
I'm fairly certain it works without them.
CString Destination= _T("C:\\Test\\");<br />
Destination+= PathFindFileName(source[aq]);<br />
Destination+="\\0";
CString Destination= _T("C:\Test\");<br />
Destination+= PathFindFileName(source[aq]);<br />
Destination+="\0";
try that.
|
|
|
|
|
it's not working.Geting error newline
|
|
|
|
|
Can you put a watch on your Destination string and tell us what that's filled with afterwards?
|
|
|
|
|
How do I pass MySQL connection ID to COM using VC++ 9.0?
At the moment I have to pass the host, username, pwd, and db name to the COM but make a new connnection there. I want to pass the connection ID but I am unable to shoehorn a variable of type MYSQL into an acceptable parameter.
GER
Ger
|
|
|
|