Don't know about Locking it but Hiding would be as easy as setting its attribute to hidden via a BAT file via (ATTRIB - DOS Command). You don't need C++ to do that I suppose.
And locking can be performed by encrypting the source file (based on some key or password algorithms) and making it mandatory to enter a password in the program accompanied along with the file so that it decrypts it based on the password.