Consultor Eletrônico



Kbase 19563: What is the support policy for ActiveX objects?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   12/02/2009
Status: Verified

GOAL:

What is the support policy for ActiveX objects?

GOAL:

What external references are useful when working with ActiveX object?

FACT(s) (Environment):

Progress 8.x
Progress 9.x
OpenEdge 10.x
Windows

FIX:

Progress Technical Support receives a large number of calls in which the developer tries to use an ActiveX object but does not know the correct syntax or structure to accomplish this from the Progress 4GL. This solution discusses support for ActiveX objects. It deals specifically with non-widget objects such as Microsoft Office rather than visual ActiveX controls such as the Progress provided Crescent Spin Control or third party ActiveX controls such as Microsoft's ListView Control because Progress Technical Support receives many calls such as: "I want to open a file in Excel, do a calculation and then save the amended file".

ActiveX objects are encapsulated Windows application objects that conform to specifications of the Microsoft Component Object Model. ActiveX objects provide functionality for applications that might not otherwise be supported by Progress.
This allows you to acquire functional elements for your Progress applications from third-party vendors as well as from Progress Software Corporation.

This is not a true Progress support issue, however support for this area is concerned when:

- The code is written and "should" work but fails with errors

- The code works on one PC but not another

- The code works from, for example, Visual Basic (VB) but not in 4GL

There are a number of resources available that can often solve the problem or at least provide an acceptable workaround. The following is an attempt to itemize a potential checklist for developers:

1) Use the COM Object Viewer supplied by Progress.
This tool is found in PRO*Tools (represented by a magnifying glass with red triangles). The executable is proobjvw.exe. The tool gives details of the COM attributes, methods, events, and syntax details on how to set or get the property or method. For a more detailed explanation of this tool, view the on-line help within the COM Object Viewer and the External Program Interfaces (EPI)manual, Chapter 7, "Using COM Objects in the 4GL".

2) Run a Macro from the 4GL.
This can be a very easy to implement workaround. What basically happens is instead of trying to write the ActiveX code in the 4GL, record a macro in the application (Tools/Macro in Word and Excel).

3) Record a macro in the application and amend the code for 4GL.
This can be a very useful starting point when you try to use an unknown or new method or property. As with No. 2, record a new macro in the application and go through the functionality as an end user:

- Open a file, make a change and save it.

- Instead of playing back the macro, select Edit.

- This gives you the VB code that the macro created.

- Change the VB period (.) to a colon (:) and the same code may be used from 4GL.

For example,
Selection.Font.Bold = True

becomes

Selection:Font:Bold = True

NOTE: Progress Technical Support does not translate a macro recorded in VB syntax into 4GL.

4) Use Progress example code
Very often you may not know where to start when you first use COM, and even creating a piece of test code can be difficult. In addition, a number of Progress error messages might often appear when you first use ActiveX. For example:

Invalid component-handle referenced while
Processing method/statement: <method or
statement name>.
<COM message> <program name> (5884)

Invalid component-handle was passed as a
parameter to method:
<method name>.
<COM message> <Program name> (5887)

Wrong number of parameters. Component method
<method name> called with parameters.
<program name>. (5888)

Error occurred while accessing component
property/method:
<property or method name>.
<COM message> Error code: <Program name>
(5890)

As a result, it makes sense to test and amend with code that is known to have the correct syntax. For examp.le:
/dlc/src/samples/activex/excelgraphs (this requires a sports database)
and others under the /activex directory provide reliable test code that can be used as a starting point when using COM.

5) Read the External Program Interfaces (EPI) manual Chapter 7 discusses COM and should be considered mandatory reading if you use this technology in an application.

6) Useful Solutions.
Search the online Progress Knowledge Center and use 'ACTIVEX' as the search word.

7) Get the correct reference manuals.
The Microsoft Language Reference Manuals are extremely useful. For example, the Microsoft Excel 2000 Language Reference (ISBN: 1-57231-955-0).

8) The Progress Email Group (api@peg.com).
Often, someone else has the same problem and has created a solution. The important thing is to share the knowledge. The PEG allows Progress developers to ask questions, get recommendations on products, compare code styles and so on.

9) Microsoft web page (www.microsoft.com).
Knowledge base articles and support details are available on COM methods and known problems.
NOTE: These suggestions may solve particular development problems but more importantly, they offer some paths for a developer to get quality information that should ease development time and cost.

Although Technical Support may not be able to help, Progress Consultancy is always available to help develop Progress/COM applications. This may save a lot of time and cost. Please contact your local Progress office for full details on this service..