Storages & Files Storages and Files

Storages and Files

In short the Storages and Files part of the ActiveX pack1 includes 3 groups of objects:

  • Basic text and binary access to streams and storages - files, directories, OLE files etc.
  • Record based DB-like access to streams (also often called flat files or random access files).
  • Miscellaneous objects - helper objects to compensate lack of some important features in certain scripting languages.

The basic part is used in the similar way as the popular FSO (FileSystemObject) supplied with the Microsoft script engines as run-time library. There is a "root" object - SFMain. The application creates that object and is able to obtain any other objects needed from it - for example SFStream for a file. The abstract model based on streams and storages allows the application to work with all the resources the same way. There is no matter if the stream is file or in-memory stream or stream in an OLE file or external stream - the application can read/write text, navigate read/write binary segments calling the same members in the same order with the same data. Once opened the resource becomes wrapped by the same object.

The record based access gives the application two advantages - to work with streams containing series of records. Such files are well known for the C++ and Pascal/Delphi programmers. They can be used for custom data base implementation, creation of applications dependent only on core features (i.e. no dependency on pre-installed components, DB engines - sometimes desired for autorun applications). With the objects in this pack this is possible not only over files but also over any stream-like resource as long as there is a component to provide the standard access to it through IStream interface.

The record based access uses a filter positioned between the record (SFrecord object) and the stream. There is default filter in the library but custom can be built. The filter is responsible to perform all the required conversions - for example ANSI to UNICODE (or reverse), byte ordering etc. The filter can be used also directly (without record) if the application needs to read/write values in non-record organized files (for example headers of many popular file formats).

The miscellaneous objects are represented by the SFShellLink and the TypeConvertor which gives the VBScript applications ability to perform bitwise operations and JScript applications ability to perform strict type casting. Cooperation between different kind of software sometimes requires the script based applications (such as ASP pages) to perform a small number of operations not very typical for scripts - bitwise operations or type conversion. Such capabilities extend the scripts application beyond the simple automation of certain processes and gives the developers rapid way to build useful tools for minutes.

See the overviews and concepts in the "General" section:

Note that all the objects use common open/create flags (called SF_Flags in the documentation)  that control the open mode (read/write), sharing and other specifics. Your work will be much more easier if you use the supplied ASP include files. The COM programmers will find that these constants are the same as in STGM enumeration (see MSDN). As the Storages and files basic features are based on standard COM interfaces there is a good level of compatibility with wide range of external components - can be used through the library objects, can benefit of the record based access over foreign implementations of stream like behavior etc.

List of the Storages and Files objects:

SFMain

Threading model: Both
Program ID: newObjects.utilctls.SFMain
ClassID: {F86AC6C2-5578-4AE8-808A-DC5DAA78082A}
Threading model: Free
ProgramID: newObjects.utilctls.SFMain.free
ClassID: {63B21C3D-6BA1-4565-9B34-E1C66E0449FD}

TypeConvertor

Threading model: Both
Program ID: newObjects.utilctls.TypeConvertor
ClassID: {2D9B783F-8DB3-4E5E-83F7-7367AB690346}
Threading model: Free
ProgramID: newObjects.utilctls.TypeConvertor.free
ClassID: {DBB52E7B-FCFC-4d85-9936-E7C4CF6B661A}

SFStream

Threading model: Both
Program ID: newObjects.utilctls.Stream
ClassID: {81D1E083-2C7F-4EFA-A45F-58A93B513A33}
Threading model: Free
ProgramID: newObjects.utilctls.Stream.free
ClassID: {F38BC51D-B506-4f89-AF62-7C6989EF1F9C}

SFStorage

Threading model: Both
Program ID: newObjects.utilctls.SFStorage
ClassID: {59B71984-3121-402E-A110-0B54BDC3EF32}
Threading model: Free
ProgramID: newObjects.utilctls.SFStorage.free
ClassID: {B05EB05E-0794-4976-83F4-9C0CC52E38DC}

SFRecord

Threading model: Both
Program ID: newObjects.utilctls.SFRecord
ClassID: {52CA1847-DDB9-49BB-96F4-099C6BC3B7E8}
Threading model: Free
ProgramID: newObjects.utilctls.SFRecord.free
ClassID: {02355E5B-2EE9-42d5-81F2-8CF7B7496F2B}

SFInfo

noncreatable (returned when file/directory/stream/storage information is requested)

SFFilter

Threading model: Both
Program ID: newObjects.utilctls.SFFilter
ClassID: {4A467FBB-711D-423A-947B-85FADC8B0913}
Threading model: Free
ProgramID: newObjects.utilctls.SFFilter.free
ClassID: {1380FA60-C871-481e-8D17-1C7B665BEC4C}

SFField

Threading model: Both
Program ID: newObjects.utilctls.SFField
ClassID: {5F88FA0B-BEC0-41B9-82A1-B67B4F187AE5}
Threading model: Free
ProgramID: newObjects.utilctls.SFField.free
ClassID: {F9A5F293-335F-421b-8C6D-97DDAE5A32E2}

SFDrive

Threading model: Both
Program ID: newObjects.utilctls.SFDrive
ClassID: {BE7887BA-10AA-47B5-BBEC-31617CCA5FB1}
Threading model: Free
ProgramID: newObjects.utilctls.SFDrive.free
ClassID: {6F280CFD-482F-46ea-B7BC-C43AF59E595C}

SFFileStream

Threading model: Both
Program ID: newObjects.binsrv.FileStream
ClassID: {1C89ABD6-F168-46A2-A562-A192DB1BC24D}
Threading model: Free
ProgramID: newObjects.binsrv.FileStream.free
ClassID: {4A4ADEA6-8124-405e-AA83-767E439FBCFC}

SFDirStorage

Threading model: Both
Program ID: newObjects.binsrv.DirStorage
ClassID: {8C5ED567-C721-4B29-8C06-3262AEDFE233}
Threading model: Free
ProgramID: newObjects.binsrv.DirStorage.free
ClassID: {0914783B-3C32-4a9f-BF7A-0D230575C30F}

SFShellLink

Threading model: Both
Program ID: newObjects.utilctls.ShellLink
ClassID: {70BD6BA6-C316-4CD5-9E95-A5BEA443ABAC}
Threading model: Free
ProgramID: newObjects.utilctls.ShellLink.free
ClassID: {48A58699-D5E5-4f7f-8F97-43378500D406}
Note:
In free threaded apartments ShellLink will not work with URL shortcuts.

SFBinaryData

Threading model: Both
Program ID: newObjects.utilctls.SFBinaryData
ClassID: {6FD08154-39CA-47AE-9299-6E37D7A894DB}
Threading model: Free
ProgramID: newObjects.utilctls.SFBinaryData.free
ClassID: {6A123D64-D17D-4ba3-9215-DEF0E037B87A}

 

newObjects Copyright 2001-2006 newObjects [ ]