带desktop.ini&的自定义文件夹图标即时刷新 [英] Custom folder icons with desktop.ini & instant refreshing

查看:331
本文介绍了带desktop.ini&的自定义文件夹图标即时刷新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的任务是创建一个簿记程序,该程序跟踪一些有关何时读取文件和文件夹的统计信息。与Google云端硬盘和TortoiseSVN相似,文件夹和文件图标应反映某些更改。例如,一个USB的文件在某台计算机上没有被查看过,而该文件的USB则为 o。

I am tasked with creating a book-keeping program that tracks some statistics of when files and folders are read. Similar to Google Drive and TortoiseSVN, the folder and file icons should reflect certain changes. For instance, a USB with files that haven't been viewed on a certain computer have an 'x', whereas viewed files get a 'o'.

我可以跟踪 Windows API和图标(以及其他一些不错的选项)可以由desktop.ini文件[ 1 2 3 4 ]。

I can track file usage with this Windows API, and icons (as well as some other nice options) can be changed by the desktop.ini files [1,2,3,4].

在手动处理desktop.ini文件时,我已成功更改了图标,说明和其他有趣的内容。问题在于,直到Windows再次解析desktop.ini文件,新的更改才会更新。这往往在几秒钟到几分钟之间不一致地发生。 F5刷新不会强制进行重新解析,但是如果进行了重新解析,则会更新映像。

While manually messing around with desktop.ini files, I've successfully changed icons, descriptions, and other fun stuff. The problem is that the new changes don't update until Windows parses the desktop.ini file again. This tends to happen inconsistently between a few seconds to several minutes. F5 refreshes do not force a reparse, but will update the image if a reparse has occurred.

如何强制Windows手动重新解析这两个文件。

是否有其他C ++ Windows API可以立即更改文件夹图标?

推荐答案

如果您编辑desktop.ini,它的资源管理器将不会自动刷新。使用 SHGetSetFolderCustomSettings 对其进行写入:

If you edit desktop.ini, it Explorer won't refresh automatically. Use SHGetSetFolderCustomSettings to write to it:

SHFOLDERCUSTOMSETTINGS fcs = {0};
fcs.dwSize = sizeof(SHFOLDERCUSTOMSETTINGS);
fcs.dwMask = FCSM_ICONFILE;
fcs.pszIconFile = iconPath;
fcs.cchIconFile = 0;
fcs.iIconIndex = iconIndex;
SHGetSetFolderCustomSettings(&fcs, folderPath, FCS_FORCEWRITE);

这篇关于带desktop.ini&的自定义文件夹图标即时刷新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆