WinExec("COMMAND.COM /C del *.txt", SW_HIDE);
Printable View
WinExec("COMMAND.COM /C del *.txt", SW_HIDE);
Download/install the latest Platform SDK. Then, using Tools/Options/Directories in the Visual Studio menu, add the SDK include and lib paths to the top of their respective lists. Rebuild All.
if you happen to have a broad band connection that allows you to down load a 300+ meg file and also happen to have the extra gig or so free hd space to compile the sdk...
Breakdown and use the winexec call, one line no fuss no muss.
You're overstating the case.
I have the SDK installed, including many of the samples, and it takes 500 Meg, not 1 Gig. Nothing needs to be compiled in the SDK in order to use it. Just put the include and lib directories under your Options settings.
And some things are only defined in the SDK, such as FOF_NORECURSION.
So, yes, WinExec could be used in this case, but having the Platform SDK installed could end up being required if you need to use certain functions or COM interfaces.
Briefly, I used SetCurrentDirectory to go to the folders and kept pFrom with the 8.3 format. I then added the still current flags for auto confirming and pop-up silence and all worked.
I thought I fully conformed to using the no long filename requirements, but apparently not. I don't think I misswd any \" escapes to pass, but anyway it now all performs as expected with the shell operation functions.
The 1026 message pops up with any discrepency such as not having a file to delete.
Thanks for assistance.
Remove "spamnot" to use e-mail
try
call it as follows:Code:void DeleteFiles(const TCHAR* tszFullPathFileNamePattern)
{
HANDLE hFile = NULL; // Handle to file
WIN32_FIND_DATA FileInformation; // File information
BOOL br = FALSE;
CString strFileName;
CString strFolderName;
CString strTemp = tszFullPathFileNamePattern;
int index = strTemp.ReverseFind('\\');
if(index>=0)
{
strFolderName = strTemp.Mid(0, index+1);
}
hFile = ::FindFirstFile(tszFullPathFileNamePattern, &FileInformation);
if(hFile != INVALID_HANDLE_VALUE)
{
do
{
if(!(FILE_ATTRIBUTE_DIRECTORY & FileInformation.dwFileAttributes))
{
strFileName = strFolderName + FileInformation.cFileName;
br = DeleteFile(strFileName);
}
} while(::FindNextFile(hFile, &FileInformation));
::FindClose(hFile);// Close handle
}
}
Code:// Delete files Crystal Reports leaves in the Temp Directory
TCHAR* tszTempDir = _tgetenv("TEMP");
CString strTempDir = tszTempDir;
DeleteFiles(strTempDir+_T("\\CPE*.tmp"));
DeleteFiles(strTempDir+_T("\\~DFB*.tmp"));
DeleteFiles(strTempDir+_T("\\ACR*.tmp"));