LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

I like to copy a complete directory with all sub directory inside of my CVI program. I am using CVI 5.51 with windows NT.


What is the best way to do this? I thought about calling xcopy, but then I do not have any control about the copy process. What is about the shell routines, which are used by the explorer?

Or is there a (hard to find) CVI API or FP, which can do this job?

Thanks

Stephan Gerhards
0 Kudos
Message 1 of 4
(3,260 Views)
Stephan:

Unfortunately, there is no LabWindows/CVI function to perform a directory copy similar to "xcopy". You can find more information about the Shell routines from MSDN (www.msdn.microsoft.com). Depending on the level of control you want, I would usually recommend the xcopy method.

Best Regards,

Chris Wood
Applications Engineer
National Instruments
0 Kudos
Message 2 of 4
(3,260 Views)
Thank you Chris.
I wrote a short function, which will do the copy by using the Shell routines. I add it to my message, maybe it's useful for other users.

Stephan

int CopyCompleteDir (HWND hwnd,
const LPSTR szFrom,
const LPSTR szTo)
{
int iReturn = 0;
HRESULT hr;
TCHAR szSource[300];
TCHAR szDest[300];
SHFILEOPSTRUCT sfo;

ZeroMemory (szSource, 300);
ZeroMemory (szDest, 300);
strcpy (szSource, szVon);
strcpy (szDest, szZu);

sfo.hwnd = hwnd;
sfo.wFunc = FO_COPY;
sfo.pFrom = szSource;
sfo.pTo = szZu;
sfo.fFlags = FOF_NOCONFIRMATION;

hr = SHFileOperation (&sfo);
if (hr != 0) iReturn = hr;
return iReturn;
}
0 Kudos
Message 3 of 4
(3,260 Views)
Hi Stephen,
Can you post more information about this code. I would like to copy complete directory. What #includes do I have to add?
Thanks.
Sheetal
Thanks.
CVI 2010
LabVIEW 2011 SP1
Vision Builder AI 2011 SP1
0 Kudos
Message 4 of 4
(3,260 Views)