Since I need to format "pretty" XML using MSXML, I am using the trick referenced here to add indentation to my code. Since all I want is to save a file, I open an IStream using SHCreateStreamOnFile(). The file gets saved, I can open it in a text editor and the XML content is there. Then I call Release() on the IStream interface so that the IStream and the file handle get closed.
Or so I tought, however Process Explorer tell me that my process still has a reference to my file once my save function exits (despite the release). I tried calling Release() a second time, but still no result, the handle doesn't get closed. All Google and MSDN could tell me was that I should call Release... But it isn't clear if Release() releases only the COM object or the file handle also.
So, is there a special way to force the close of a file handle created by SHCreateStreamOnFile()? Or is there a better way to obtain an IStream on a file? Do I need to call Release() on the IMXWriter, ISAXXMLReader and IStream in a specific order?
Thank you in advance.