Patron always keeps the root storage open. If a new file is created (from a File New command), Patron uses a temporary compound file created by passing a NULL to StgCreateDocfile along with STGM_DELETEONRELEASE, which should be the default for temporary files:
hr=StgCreateDocfile(NULL, STGM_TRANSACTED | STGM_READWRITE
| STGM_SHARE_EXCLUSIVE | STGM_CREATE | STGM_DELETEONRELEASE
, 0, &m_pIStorage);
If a file is loaded from disk (opened with the File Open command), Patron opens it with StgOpenStorage and keeps that storage open. One of these two functions is called from CPatronDoc::Load, depending on whether the end user chose File New or File Open.
Keeping a transacted storage open in this manner is a little expensive in terms of file handles. It allows us, however, to open any number of substorages and streams at any other time and in any other place in the code. If you are able to tolerate the cost of the file handles, this can be very convenient for application design, especially if you are running on a system for which file handles are not a scarce system resource.
The temporary file created in StgCreateDocfile will appear on the file system in your environment's TEMP directory with a pseudorandom name (such as ~DF4C8.TMP). If you specify STGM_DELETEONRELEASE, OLE will clean the files out of the directory, but if the application crashes (as it will under development, no doubt) or if the user turns off the machine without closing files, the TEMP directory can become cluttered with garbage files. I suggest that you check for these files periodically during your development work and warn your end users in the application's documentation.