BCX COM Interface Procedures

Limitations:

  1. The length of a COM OBJECT name is not allowed to exceed 64 characters.
  2. AN OBJECT variable can not be initialized as pointer.
    
     DIM xxx AS OBJECT PTR
    
    
    is not allowed and neither is this
    
     DIM xxx AS OBJECT*
    
    
  3. It is illegal to dimension an array of OBJECT.
    
     DIM xxx[22] AS OBJECT
    
    
    is not allowed.
  4. An OBJECT can not be declared or used in a UDT.
  5. CREATEOBJECT is not capable of creating a remote OBJECT.
    
     CREATEOBJECT("Excel.Application","\\at_net_pc1")
    
    
    is illegal.
  6. Do NOT use names for variables that you may have already assigned to global COM object variables.
  7. Do NOT use line continuation chars '_' in COM statements.
  8. Named arguments are not supported.
  9. Do not use any operands (+, -, & ...) on the same line as an OBJECT variable. The BCX COM parser can not properly parse, for example, this
    
     app.server = "my" & "server" & somevar$ 
    
    
    so instead, use something like this
    
     myvar$ = "my" & "server" & somevar$ 
     app.server = myvar$
    
    
  10. In some COM statements, a SINGLE or DOUBLE precision float data type value must be expressed using a variable with an appended data type signifier, that is, ! for a SINGLE and # for a DOUBLE rather than using a literal expression or a variable without an appeneded datatype signifier. For example, the BCX COM parser can not properly parse this
    
     xlApp.ActiveSheet.Shapes.AddLine(1.5, 5.5, 505, 170.5).select
    
    
    so instead, use a construct like this
    
     DIM P1 AS SINGLE
     DIM P2 AS SINGLE
     DIM P3 AS SINGLE
     DIM P4 AS SINGLE
     
     P1! = 1.5
     P2! = 5.5
     P3! = 505
     P4! = 170.5
     
     xlApp.ActiveSheet.Shapes.AddLine(P1!, P2!, P3!, P4!).select
    
    
    Here is a complete correct example
    
     '**************************************************
     ' This sample requires MS Excel to run.
     ' This draws a red, dashed line via COM automation
     '**************************************************
     
     CONST msoLineDashDotDot = 6
     
     DIM xlApp AS OBJECT
     
     DIM P1 AS SINGLE
     DIM P2 AS SINGLE
     DIM P3 AS SINGLE
     DIM P4 AS SINGLE
     
     set xlApp = CreateObject("Excel.Application")
     
     xlApp.workbooks.add
     xlApp.visible = TRUE
     
     P1! = 1.5
     P2! = 5.5
     P3! = 505
     P4! = 170.5
     
     ' ****************************************************
     ' NOTE WELL:
     ' The appended "!" data type specifiers on the "Px" variables 
     ' is crucial to the proper parsing of the following statement
     '*****************************************************
     
     xlApp.ActiveSheet.Shapes.AddLine(P1!, P2!, P3!, P4!).select
     
     xlApp.Selection.shapeRange.Line.DashStyle = msoLineDashDotDot
     xlApp.Selection.ShapeRange.Line.ForeColor.rgb = 255
     
     Sleep(5000)
     
     xlApp.Quit
     
     SET xlApp = NOTHING
    
    

$COM_ON and $COM_OFF directives

Purpose: The default setting in the BCX translator is $COM_ON which specifies that COM procedures are used in the code being translated. $COM_OFF indicates that that COM procedures are not being used in the code being translated.


 Syntax:

 $COM_ON or $COM_OFF

 Parameters:

  • None

When any BCX COM interface procedure is invoked, the translator automatically adds the following define to the output C code.


#ifndef _WIN32_DCOM
#define _WIN32_DCOM
#endif

BCX provides the following run-time procedures for working with COM/ActiveX objects:

How to


All products mentioned in this manual and/or in program samples are trademarks of their respective owners.