惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

腾讯CDC
Schneier on Security
Schneier on Security
B
Blog RSS Feed
aimingoo的专栏
aimingoo的专栏
P
Proofpoint News Feed
A
About on SuperTechFans
Recorded Future
Recorded Future
Recent Announcements
Recent Announcements
Microsoft Security Blog
Microsoft Security Blog
L
LangChain Blog
Hugging Face - Blog
Hugging Face - Blog
The GitHub Blog
The GitHub Blog
Google DeepMind News
Google DeepMind News
T
Tailwind CSS Blog
Vercel News
Vercel News
H
Hackread – Cybersecurity News, Data Breaches, AI and More
MyScale Blog
MyScale Blog
V2EX - 技术
V2EX - 技术
N
Netflix TechBlog - Medium
F
Fortinet All Blogs
V
Visual Studio Blog
Martin Fowler
Martin Fowler
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
博客园 - Franky
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
T
The Exploit Database - CXSecurity.com
F
Full Disclosure
Scott Helme
Scott Helme
H
Heimdal Security Blog
博客园 - 叶小钗
Google DeepMind News
Google DeepMind News
Cyberwarzone
Cyberwarzone
Application and Cybersecurity Blog
Application and Cybersecurity Blog
V
Vulnerabilities – Threatpost
Blog — PlanetScale
Blog — PlanetScale
Security Latest
Security Latest
WordPress大学
WordPress大学
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
T
Troy Hunt's Blog
S
SegmentFault 最新的问题
Forbes - Security
Forbes - Security
Jina AI
Jina AI
S
Securelist
小众软件
小众软件
Simon Willison's Weblog
Simon Willison's Weblog
J
Java Code Geeks
AWS News Blog
AWS News Blog
N
News and Events Feed by Topic
博客园 - 三生石上(FineUI控件)
量子位

博客园 - avisnet

枚举浏览器窗口 关闭弹出式IE浏览器窗口编程 iframe自适应高度 - avisnet - 博客园 实现集合类的帮助函数 FormView 在对话框里面使用ON_UPDATE_COMMAND_UI映射工具条 automation服务器不能创建对象 汇率 无题 [转]猪的爱情故事 在新窗口中打开网页,同时关闭原有窗口 低层键盘钩子 C++编译器默认声明的成员函数 使用SqlServer模式的会话状态管理 Session Data Is Lost When You Use ASP.NET InProc Session State Mode [转]LINK : warning LNK4089: all references to "xxx.dll" discarded by /OPT:REF VC++中消除警告 const与typedef的中高级使用 在 ASP.NET 中执行 URL 重写
删除文件至回收站而不是永久删除
avisnet · 2006-09-23 · via 博客园 - avisnet

class CRecycleFile : private SHFILEOPSTRUCT
{
public:

 CRecycleFile()
 {
  memset((SHFILEOPSTRUCT*)this,0,sizeof(SHFILEOPSTRUCT));
  fFlags |= FOF_SILENT;                // don't report progress
  fFlags |= FOF_NOERRORUI;             // don't report errors
  fFlags |= FOF_NOCONFIRMATION;        // don't confirm delete
 }

 ~CRecycleFile()
 {
 }

 //
 // Send a file to the recycle bin. Args:
 //  - full pathname of file.
 //  - bDelete: if TRUE, really delete file (no recycle bin)
 //
 int Recycle(LPCTSTR pszPath, BOOL bDelete=FALSE)
 {
  TCHAR buf[_MAX_PATH + 1]; // allow one more character
  _tcscpy(buf, pszPath);    // copy caller's path name
  buf[_tcslen(buf)+1]=0;    // need two NULLs at end

  // Set SHFILEOPSTRUCT params for delete operation

  wFunc = FO_DELETE;                   // REQUIRED: delete operation
  pFrom = buf;                         // REQUIRED: which file(s)
  pTo = NULL;                          // MUST be NULL
  if(bDelete)
  {                       // if delete requested..
   fFlags &= ~FOF_ALLOWUNDO;         // ..don't use Recycle Bin
  }
  else
  {                             // otherwise..
   fFlags |= FOF_ALLOWUNDO;          // ..send to Recycle Bin
  }
  return SHFileOperation(this);        // do it!
 }