I am about to use IStorage and i think i found an error in the declaration + i have a few questions.
I was testing with your winapi headers and i think pwcsName should be a DWORD PTR and not a word ptr.
(pwcsName As Dword Ptr ' LPOLESTR pwcsName)
Q1:
(removed, it was shown in the example above :) )
Local oIEnumSTATSTG As IEnumSTATSTG
pStorage.EnumElements( 0, 0, 0, oIEnumSTATSTG )
MsgBox Str$( IsObject( oIEnumSTATSTG ) )
Local s As STATSTG
Local pceltFetched As Dword
oIEnumSTATSTG.Next( 1, s, pceltFetched )
Local pS As String Ptr
ps = s.pwcsName
MsgBox ACode$( Peek$( s.pwcsName, 12 ) )
CoTaskMemFree( s.pwcsName ): s.pwcsName = 0
Q2:
Your examples clearly show a distinction between IStorage streams and IPropertySetStorage.
While i am reading msdn it's not clear to me if i can have both in one file.
Q3:
If these property storage (IPropertySetStorage) can't be mixed with streams, does this mean i need to find a structure for storage in the stream myself?
One of the things i am looking for is storing dataitems having a tagname.
Thanks,
Quote
I was testing with your winapi headers and i think pwcsName should be a DWORD PTR and not a word ptr.
It is a pointer to a null-terminated Unicode string and each character is 2 bytes (16 bits), that is a WORD. What it is not is a STRING PTR. Anyway, if you are going to use PEEK$ or CopyMemory or anything like that, it doesn't matter as long as it is a 32-bit value.
Quote
Your examples clearly show a distinction between IStorage streams and IPropertySetStorage.
While i am reading msdn it's not clear to me if i can have both in one file.
When you create or open an storage, you have to specify IID_IStorage for storages or IID_IPropertySetStorage for property storages. Storages allow you to create substorages and write/read streams, not property storages, and property storages don't allow you to create storages and streams.
Quote
If these property storage (IPropertySetStorage) can't be mixed with streams, does this mean i need to find a structure for storage in the stream myself?
One of the things i am looking for is storing dataitems having a tagname.
You write properties using the WriteMultiple and WritePropertyNames methods. You retrieve them using the ReadMultiple method. One of the parameters of ReadMultiple is an array of PROPSPEC structures (or only one structure if you only want to read one property). The ulKind member of the PROPSPEC structure indicates the union member used: PRSPEC_LPWSTR for string name, PRSPEC_PROPID for property ID. In the first case, fill the lpwstr member of the union with a pointer to a null-terminated Unicode string; in the second case, fill the propid member with the property ID.
Thank you!
Just a question what needs a short answer :)
So far i see a combo of IStorage and one or more streams.
Below that level i only see custom stuff, for example one of the streams could be a serialized object, serialisation would require to be implemented by myself (isn't?).
I intend to save forms from my visual designer into a stream, i guess one per stream.
The form contents would be serialized with my own code.
Do i overlook something?
To be able to store all kinds of stuff i choose to use the IStorage interface.
So far i only seem to benefit from transactional updates and updates of single elements (stream).
This may improve the writing somewhat.
I'm not sure of what you mean. It is up to you what you put in the streams.
I am looking for confirmation if i use IStorage there is not much else then nested storages and streams isn't?
I create a file based storage object which can hold other storage objects and stream objects.
if so this implies that the final content is something custom and no object logic we can use.
And what else are you expecting?
Quote
The IStorage interface supports the creation and management of structured storage objects. Structured storage allows hierarchical storage of information within a single file, and is often referred to as "a file system within a file". Elements of a structured storage object are storages and streams. Storages are analogous to directories, and streams are analogous to files. Within a structured storage there will be a primary storage object that may contain substorages, possibly nested, and streams. Storages provide the structure of the object, and streams contain the data, which is manipulated through the IStream interface.
The IStorage interface provides methods for creating and managing the root storage object, child storage objects, and stream objects. These methods can create, open, enumerate, move, copy, rename, or delete the elements in the storage object.
Some way to insert and distinct items inside the stream.
Well, your answer says enough, thanks,
:)