Ole4D Methods

OCCreaFromBlob(p_AreaVar;p_Blob)

Method OCCreaFromBlob, loads an Ole object from a blob. This method is the pair of OCSaveToBlob. Using OCCreaFromBlob and OCSaveToBlob you can implement persistence and serialization of the ole object. The blob is a buffer that can be saved and loaded from database.
The OCCreaFromBlob command destroys the existing object (if any) created in the plug-in area.It also destroys all script hosts where that object was declared.

Parameters
Parameter Type   Description
p_AreaVar Longint -> Variable of the plug-in area.
p_Blob Blob -> Blob variable (process or interprocess) from which the Ole object is created.


Return Values
0 – The method call was successful.
If the method call was not successful the return value is non zero. For more information call OCLastError.

Remarks
If the object is in the active state when is saved then it will be activated automatically after loading from blob.


Example
$i := OCCreaFromProgId(OriginalObj;“WordDocument”)
If ($i#0)
  ALERT(String($i)+OCSysMessage($i))
Else
  $i:=OCActivate(OlePlugIn)
  If ($i#0)
    ALERT(OCSysMessage($i))
  End if
End if
C_BLOB(bl)
SET BLOB SIZE(bl;6)

`save the object to blob
$i := OCSaveToBlob(OriginalObj;bl)

`load the object from blob
$i := OCCreaFromBlob(DuplicateObj;bl) __________________________________________________ QUERY([SavedBlobs];[SavedBlobs]Id=12423) $i:=OCCreaFromBlob (Area1;[SavedBlobs]Value)


See Also
OCCreaFromFile, OCCreaFromProgId, OCCreaFromCLSID, OCCreaFromBlob, OCDestroyObject, OCActivate, OCSaveToBlob