Logo

Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.

CREATEBINARY()

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

Usage

cOutString = CreateBinary( cInString )
</tr> </table> 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 ```foxpro 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](/section4/s4g347.html), [OLEBoundControl](/section4/s4g518.html), [OLEControl](/section4/s4g518.html)

Parameter

Value

Meaning

cInString

Character

Binary characters to be converted.

cOutString </td>

Character

String flagged internally by VFP as containing binary data.