Click to See Complete Forum and Search --> : Could some one explain how to create a compound file that support the single-write, multiple-reader,


Johan K
June 21st, 1999, 02:18 AM
Hi!

I posted this question a few days ago, but didn't get any answer. Hope to have better luck this time.

Could some one explain how to create (use) a compound file that support the single-write, multiple-reader, direct mode.
I have tried to use the STGM_READWRITE | STGM_SHARE_DENY_WRITE access mode, but the function ::StgCreateDocfile and ::StgOpenStorage return STG_E_INVALIDEFLAG.
The only access mode combination that works for me is when I include the STGM_SHARE_EXCLUSIVE.

I create the file like this...
CComQIPtr<IStorage,&IID_IStorage> pIstgRoot;
HRESULT hr = ::StgCreateDocfile(_0("d.\\Compound.fil"), STGM_CREATE | STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, &pIStgRoot);
/* would like to use STGM_CREATE | STGM_READWRITE | STGM_SHARE_DENY_WRITE mode but it fails.
Add some storage.
Then close the file.

In my applications I use
CComQIPtr<IStorage,&IID_IStorage> pIstgRoot;
::StgOpenStorage("d.\\Compound.fil", NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, NULL, 0, &pIstgRoot)))
// would like to use STGM_READWRITE | STGM_SHARE_DENY_WRITE mode but it fails.
... to open the file.

I must be able to use multiple-reader, direct mode.

Best Regards

/Joh@n