这是我的可以的例子,供参考
#include "stdafx.h"
#include "windows.h"
#include "iostream.h"
int main(int argc, char* argv[])
{
IStorage *stg=0;
IStorage *storage=0;
IStream * stream=0;
long l=::StgCreateDocfile(L"f:\\mystorage\\s1",STGM_SHARE_EXCLUSIVE|STGM_CREATE|STGM_READWRITE,0,&stg);
/*long l=::StgIsStorageFile(L"f:\\mystorage\\s1");
if(l==S_OK)
{
cout<<"the file is a structured storage file"<<endl;
}
else
{
cout<<"the file is not a structured storage file"<<endl;
}*/
    HRESULT hr=stg->CreateStorage(L"s1_storage",STGM_SHARE_EXCLUSIVE|STGM_CREATE|STGM_READWRITE,0,0,&storage);
/*HRESULT*/ hr=stg->CreateStream(L"s1_stream",STGM_SHARE_EXCLUSIVE|STGM_CREATE|STGM_READWRITE,0,0,&stream);
    ULONG cb; stream->Write(L"hello world",20,&cb);
stream->Release();
    storage->Release();
stg->Release();
return 0;
}