CreateBinary()

This function converts a string containing binary data to a format that can be recognized by an OLE object.

Usage

cOutString = CreateBinary( cInString )

Parameter

Value

Meaning

cInString

Character

Binary characters to be converted.

cOutString

Character

String flagged internally by VFP as containing binary data.


When working exclusively in Visual FoxPro, this function is not necessary. It is used for passing information back and forth to OLE objects and controls. Visual FoxPro actually does a lot of translation behind the scenes when interacting with OLE objects, and this is one of those cases where we have to give it a hint. When passing character variables to an OLE object, VFP translates them into the OLE type string. OLE strings, however, can only hold text, and not the binary data that Visual FoxPro is capable of storing in character variables. CREATEBINARY() flags a variable as containing binary information, so that FoxPro's built-in translation mechanisms know how to convert it before sending it to the OLE control.Note that you can only abbreviate the function to CreateB(), due to the other functions CreateObject() and CreateOffline().

Example

lcString1 = CHR(01) + CHR(02) + CHR(03)
lcString2 = CreateBinary( lcString1 )
? lcString2 == lcString1  && .T., identical within VFP
oObject.Method(lcString1)  && OLE Error
oObject.Method(lcString2)  && works

See Also

CreateObject, OLEBoundControl, OLEControl


Back to Table of Contents

Copyright © 2002-2018 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. Click for license .