As you said , I overrided CDocument::OnOpenDocument() , but I simply open a text file and in that case this function isn't been called.I think it only opens files that are saved with serilizing and using CArchive and it doesn't open my text file.I used a text file to save graphic items that are drawn by the user in my project and I want user can open the file in a symbolic way then I draw the items using text file.However this is enough for me that I can get the name of file even if it hasn't opened really.I thought it opens file and I can not open it simultanously.But even for a file that is saved with the CArchive format, it seems that it opens the corresponding file and then close it because I can open the same file at that time.