I try to delete files using Shell Structure. Instead of deleting file by file using :: DeleteFile(), I want to delete all files with a wild character (.*).

//CComBSTR with the path to files (i.e. "C:\Files\files.*")
// filePath and fileName is passed to this function as BSTR types
CComBSTR pathWild(filePath);
pathWild.Append("\\");
pathWild.Append(fileName);
pathWild.Append(".*");

// Delete files
SHFILEOPSTRUCT shDelete;
HRESULT hr;

shDelete.wFunc = FO_DELETE;
shDelete.fFlags = FOF_SILENT | FOF_NOCONFIRMATION;
shDelete.pFrom = pathWild;
shDelete.pTo = NULL;

hr = SHFileOperation(&shDelete);

I got an error 1026, and nothing was deleted. shDelete.pFrom accepts an "Address of a buffer to specify one or more source file names", I guess it doesn't like CComBSTR. How could I solve this problem?!

Any help is highly appreciated (Second day I am trying to solve it). Maybe there is another way to delete files with wild character?!