char buf[64];
SHFILEOPSTRUCT fo;我看别人都好好的,没见有我这样的问题。下面这段代码可以删除指定目录及文件,但是总是弹出一个对话框询问是否删除到回收站。
如何屏蔽这个对话框,删就删了。 memset(buf, 0, sizeof(buf));
memset(&fo, 0, sizeof(SHFILEOPSTRUCT));
strcpy(buf, strDir);
buf[strlen(buf)+1] = 0;
fo.wFunc = FO_DELETE;
fo.pFrom = buf;
fo.fFlags = FOF_ALLOWUNDO; SHFileOperation(&fo); RemoveDirectory(strDir);
SHFILEOPSTRUCT fo;我看别人都好好的,没见有我这样的问题。下面这段代码可以删除指定目录及文件,但是总是弹出一个对话框询问是否删除到回收站。
如何屏蔽这个对话框,删就删了。 memset(buf, 0, sizeof(buf));
memset(&fo, 0, sizeof(SHFILEOPSTRUCT));
strcpy(buf, strDir);
buf[strlen(buf)+1] = 0;
fo.wFunc = FO_DELETE;
fo.pFrom = buf;
fo.fFlags = FOF_ALLOWUNDO; SHFileOperation(&fo); RemoveDirectory(strDir);
shfileop.hwnd = NULL;
shfileop.wFunc = FO_DELETE ;
shfileop.fFlags = FOF_SILENT | FOF_NOCONFIRMATION;
shfileop.pFrom = "c:\\Download1";
shfileop.pTo = "";
shfileop.lpszProgressTitle = "";
shfileop.fAnyOperationsAborted = TRUE;
int nOK = SHFileOperation(&shfileop);
When used to delete a file, SHFileOperation attempts to place the deleted file in the Recycle Bin. If you wish to delete a file and guarantee that it will not be placed in the Recycle Bin, use DeleteFile.
怎么没有删除到回收站中。
我发现只修改这句就OK了:shfileop.fFlags = FOF_SILENT | FOF_NOCONFIRMATION;
我开始也这样组合了,怎么没出来,大概是晕了。^_^