I'm currently working on an editor, and am looking for a best practices in regards to the opening and closing of files using the win32 api. Issues I'm facing currently are code duplication, especially in the closing/saving of file (is a file open? has it been changed? do we want to save? has it been saved before?). Any thoughts?