Closing the file opened via StgOpenStorage


hi,

how close file opened via stgopenstorage.

example

        #region stgopenstorage

        [dllimport("ole32.dll")]

        static extern int stgopenstorage([marshalas(unmanagedtype.lpwstr)]string pwcsname, istorage pstgpriority, stgm grfmode, intptr snbexclude, uint researved, out istorage ppstgopen);

        #endregion

istorage istorage1;

int result;

            // open structured storage file in readwrite , share_exclusive
            result = stgopenstorage("c:\\oleobject1.bin", null, stgm.readwrite | stgm.share_exclusive, intptr.zero, 0, out istorage1);

after processing above *.bin file, need delete it. while tried delete file("c:\\oleobject1.bin") using file.delete error thrown ("file used process").

hence how close file opened via stgopenstorage.

thanks in advance.

check members of istorage , try calling istorage1.commit. call marshal.finalreleasecomobject(istorage1).



Visual Studio Languages  ,  .NET Framework  >  Visual C#



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

BizTalk Server 2013 Azure VM Log Shipping and HA for hosts

How to Share webservice object to all user