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

job syspolicy_purge_history job fail in sqlserver 2008

Trying to register with public marketplace error with 'Get-AzureStackStampInformation'