Try OpenEdge Now
skip to main content
Programming Interfaces
External Program Interfaces : Using COM Objects in ABL : Accessing COM object properties and methods : Property and method syntax : Method name reference
 
Method name reference
This is the syntax to specify a single COM object method:

Syntax

Method-Name
(
{ [ OUTPUT | INPUT-OUTPUT ]
expression [ AS datatype ]
[ BY-POINTER | BY-VARIANT-POINTER ]
| null-parameter
}
[ , [ OUTPUT | INPUT-OUTPUT ]
expression [ AS datatype ]
[ BY-POINTER | BY-VARIANT-POINTER ]
| null-parameter
]...
)
Method-name
The name of the COM object method. This name is not case sensitive. But by convention, OpenEdge documentation shows COM object method names in mixed case.
expression
Any valid ABL expression that you can pass as a parameter to the method.
datatype
One of several data-type specifiers that the associated parameter might require. For more information on datatype, see Table 60. The remaining keyword options specify additional type and mode information for each parameter. The COM object defines the data types and numbers of parameters for a method.
null-parameter
Any amount of white space, indicating an optional parameter that you choose to omit. You can also pass variable numbers of parameters if the method supports it. For more information on specifying method parameter options, see Specifying options for properties and method parameters.
You can invoke a method in two ways:
*Include the appropriate method reference as part of an ABL expression. This expression can be on the right side of an assignment statement or in any other statement that accepts the expression. Methods invoked with this technique must return a value. For example, if YearDay() is a method that returns the number of days from the first of the year to a specified date, it can appear in the following bolded expressions:
DEFINE VARIABLE myObject    AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE day-of-year AS INTEGER    NO-UNDO.

/* ... Access COM object as myObject ... */

day-of-year = myObject:YearDay("05/01/1997").

DISPLAY myObject:YearDay(TODAY) " days have passed this year.".
*Specify the appropriate method reference as a statement, ignoring any return value. Methods invoked as a statement might require the NO-RETURN-VALUE option (shown previously in the Method Reference syntax). If SetDate( ) allows you to set a date for a COM object, you might invoke it in the following bolded statements:
DEFINE VARIABLE myObject    AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE day-of-year AS INTEGER    NO-UNDO.

/* ... Access COM object as myObject ... */

NO-RETURN-VALUE myObject:SetDate(1995,5,1). /* Set "May 1, 1995" */
myObject:SetDate(,5,1). /* Set "May 1" of current year */