OnFileGetSize event/delegate/callback


Pascal    Plain C    C++ (DLL/Lib)    C++ (VCL)    C++ (.NET)    C#    VB.NET    Java 

SolFSStorage     See also    


This event is fired when CBFS Storage wants to know current size of the storage.


    TSolFSGetFileSizeEvent = procedure( Sender : TObject; FileHandle : THandle; var Size : Int64; var Result : LongInt) of object;

[Plain C]
    typedef Error (__stdcall *SolFSGetFileSizeFunc)( LongWord UserData, LongLongWord *Size, Handle FileHandle);

[C++ (DLL/Lib)]
    typedef Error (__stdcall *SolFSGetFileSizeFunc)( LongWord UserData, LongLongWord *Size, Handle FileHandle);

[C++ (VCL)]
    typedef void (__closure *TSolFSGetFileSizeEvent)( System::TObject* Sender, Handle FileHandle, LongLongWord *Size, Error& Result);

[C++ (.NET)]
    public __delegate void SolFSGetFileSizeEvent( SolFSStorage* Sender, UInt32 FileHandle, LongLongWord __gc &Size, Int32 __gc &Result);

    public void SolFSGetFileSizeEvent( SolFSStorage Sender, uint FileHandle, ref ulong Size, ref int Result);

    Sub SolFSGetFileSizeEvent( ByVal Sender As SolFSStorage, ByVal FileHandle As UInt32, ByRef Size As UInt64, ByRef Result As Int32)

    long ISolFSFileEvents.onFileGetSize()


  • Sender - reference to the class that called the delegate/event handler.
  • FileHandle - Handle to the storage, whose size needs to be queried.
  • Size - out parameter to which the application must place the size of the file.
  • Result - out parameter (return value for DLL) where the application places the result of the operation. If you are working with file system, Win32 error code is a good candidate for placing to Result parameter. Otherwise you can use any other error codes, just be sure that 0 means success.
    [Java]See Description for details about error reporting in Java.

  • [Plain C] UserData - application-defined parameter which is specified when creating the storage and passed back to callback function.

[Java]  Return values

Current size of the storage file.


This event is fired when CBFS Storage needs to know current size of the storage.

The callback/event handler must be set before the storage is opened.

You need to implement ISolFSFileEvents interface in your code and pass the object, that implements the events, to one of SolFSStorage constructors that accept storageEvents parameter.

ERROR REPORTING: In Java you can't return more than one parameter, so the natural way is to throw an exception. You can throw any exception, and this exception will be passed back to the code, which called one of CBFS Storage functions. So if you use callback mechanism and throw exception from within event handlers, be sure to wrap each call to CBFS Storage methods with try/catch.

See also

Information about callbacks (Operating System edition only)     OnFileSetSize