开发者

How I could to forbid show of hidden/system files in TOpenDialog?

开发者 https://www.devze.com 2023-04-10 02:10 出处:网络
I tried to write a program for safe deleting files. However, I have a problem with deleting system files (recycle bi开发者_高级运维n etc.). Now my question is. Which way to hidden files (from users) a

I tried to write a program for safe deleting files. However, I have a problem with deleting system files (recycle bi开发者_高级运维n etc.). Now my question is. Which way to hidden files (from users) at this dialog. Other files I add to listview and then rewrite them zeroes. After that I delete this files without recycle.


The only way guaranteed to do this is to write your own open file dialog. But I'd advise that you find a better way of doing this, since that's considered pretty bad form.

It just occurred to me, but what you could do (and I'm not saying it's easy or nice) is launch the open file dialog, then using the handle to the window gain access to the listbox, and manually remove any system files from that list per your own heuristics. It should work, but I can't guarantee that the items will remain removed (i.e. I think Windows will auto-refresh every so often), so you'll have to experiment and YMMV.

Bottom line: find a different way of preventing the user from selecting them. Like Mat says, perhaps just give a message and leave it at that. Failing that, write your own dialog (yuck!).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号