Gold mine of Visual C++ tricks!
![]()
Hidden files are very basic and primitive mode of protection. If your file is set as hidden, it won’t get listed to normal user, unless he explicitly enabled – “Show hidden files”. Well, how to make a file really hidden?

![]()
You can use the api – SetFileAttributes(). Pass FILE_ATTRIBUTE_HIDDEN as attribute and you’re file will be hidden. Have a look at the code snippet.
// The file, which is to be hidden.
CString csFile = _T("C:\\Autumn Leaves.jpg");
// Hide the file.
SetFileAttributes( csFile, FILE_ATTRIBUTE_HIDDEN );
![]()
Another alternative is to use CFile::SetStatus(). Have a look at it too…
![]()
Targeted Audience – Beginners.
This entry was posted by Jijo Raj on August 18, 2008 at 6:06 pm, and is filed under Codeproject, Windows APIs. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site.
Nice post, Write some more interesting articles.
Thanks
Thanks a lot, buddy!!! Sure, expect more interesting tips. Keep watching!!!
Regards,
Jijo.
Hey man! Thanks for the tip!
I have a question though, if I place such a hidden file in the startup folder, it wont start, or will it?
is there a way to make it start, programatically?
I would appreciate and answer, and thanks for the great blog!