Highlighted
Absent Member.
Absent Member.
353 views

[archive] Calling a 3rd party COM Object

[Migrated content. Thread originally posted on 15 January 2008]

I am having problems calling a method in a COM object and need some help.

Below is the DEF file that was created from the DLL when I used AXDEFGEN.EXE.

>>IMP(ACU-CBLFLAGS=-Sa)
* C:\Jim's activeX test\xcharge.def - OLE object definitions
* Generated: Monday, January 07, 2008
* Typelib..: C:\XCharge\X-Charge Tech

OBJECT @eXpressLink

* Dispatch interface for XCeXpressLink Object

* IXCeXpressLink
CLASS @IXCeXpressLink
CLSID, 06277D48-1071-4380-8A0A-8D5A304B10FE
NAME, "IXCeXpressLink"
* IsXCClientRunning
METHOD, 1, @IsXCClientRunning,
"boolean*" @Future, TYPE 16395
OPTIONAL 1
RETURNING "long", TYPE 3
* ExecuteXCClient
METHOD, 2, @ExecuteXCClient,
"BSTR" @Parameters, TYPE 8,
"boolean" @Wait, TYPE 11
RETURNING "long", TYPE 3
* ActivateXCClient
METHOD, 3, @ActivateXCClient,
"boolean" @Future, TYPE 11
OPTIONAL 1
RETURNING "long", TYPE 3

* XCeXpressLink Object

*** Primary Interface ***

* XCeXpressLink
CLASS @XCeXpressLink
CLSID, 93A21EF1-A8F0-4C1B-82C9-A7A1BF180DED
NAME, "XCeXpressLink"
PRIMARY-INTERFACE
DEFAULT-INTERFACE, "IXCeXpressLink"
* IsXCClientRunning
METHOD, 1, @IsXCClientRunning,
"boolean*" @Future, TYPE 16395
OPTIONAL 1
RETURNING "long", TYPE 3
* ExecuteXCClient
METHOD, 2, @ExecuteXCClient,
"BSTR" @Parameters, TYPE 8,
"boolean" @Wait, TYPE 11
RETURNING "long", TYPE 3
* ActivateXCClient
METHOD, 3, @ActivateXCClient,
"boolean" @Future, TYPE 11
OPTIONAL 1
RETURNING "long", TYPE 3


I am trying to execute the IsXCClientRunning method but I get the following compile error.

program.cbl, line 68: Warning: '.' expected, INPUT-OUTPUT found
program.cbl, line 2405: Undefined data item: ISXCCLIENTRUNNING


Here is some code sniplets that I have in my program.

This is were I have added my DEF copybook as per some of the examples and
I am getting the first warning on this code. Does the DEF need to be in the
SPECIAL-NAMES heading?

CONFIGURATION SECTION.

SOURCE-COMPUTER. RealWorld.
OBJECT-COMPUTER. RealWorld.

SPECIAL-NAMES.

COPY "XCHARGE.DEF".

INPUT-OUTPUT SECTION.


This is defining the return code and the Handle.

01 EXPRESSLINK-STATUS PIC X(4) COMP-N.
88 EXPRESSLINK-IS-FALSE VALUE 0.

01 XCHARGE-HANDLE USAGE IS HANDLE.


This is where I am creating the Class and trying to use a method in the Class and this is where I am getting the other compile error.

CREATE IXCeXpressLink HANDLE IS XCHARGE-HANDLE.
INQUIRE XCHARGE-HANDLE IsXCClientRunning
IN EXPRESSLINK-STATUS.
DESTROY XCHARGE-HANDLE.


Please forgive my ignorance of the correct terminology but this is the first time I have tried to call a VB object.

Thanks and please let me know if there is any other information that you need.

Jim
0 Likes
7 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] Calling a 3rd party COM Object

The definition files does not include a "terminating" period. This is by design. So you need to add a line with a period after the line with COPY "XCHARGE.DEF".
One more thing, you shall never create an object using its secondary interface, but its primary interface.
Thus, change this:
CREATE IXCeXpressLink HANDLE IS XCHARGE-HANDLE.
to this:
CREATE XCeXpressLink HANDLE IS XCHARGE-HANDLE.
This should do the trick.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Calling a 3rd party COM Object

gforseth,

Thanks for the quick response. The period did the trick for the warning, but I am still getting the following compile errors when I try to compile the program.

program.cbl, line 2405: Undefined data item: ISXCCLIENTRUNNING
program.cbl, line 2405: Verb expected, GIVING found


I did a bit more research last night and I was previously using the INQUIRE command on a method. After a lot of studing I came to the conclusion that the INQUIRE command is for Properties and I needed to use the MODIFY command on a Method. Please correct me if I am wrong!
Here is a snipit of the code that I am still getting the compile error on:

JFWTST CREATE XCeXpressLink HANDLE IS XCHARGE-HANDLE.
JFWTST MODIFY XCHARGE-HANDLE IsXCClientRunning
JFWTST GIVING EXPRESSLINK-STATUS.
JFWTST DESTROY XCHARGE-HANDLE.



If you need to reference the DEF file it should be in my original post.

Thanks again for your help.

Jim
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Calling a 3rd party COM Object

Try to add "()" here, such as:

JFWTST MODIFY XCHARGE-HANDLE IsXCClientRunning()
JFWTST GIVING EXPRESSLINK-STATUS.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Calling a 3rd party COM Object

I have used the following variations;
"@IsXCClientRunning"
"@IsXCClientRunning"()
"IsXCClientRunning"
"IsXCClientRunning"()
@IsXCClientRunning
@IsXCClientRunning()
IsXCClientRunning()
IsXCClientRunning

All of the above create some sort of Compile error. When I use quotes I get "Verb expected, Literal found" error.
Oterwise I get the "Undefined Data Name" error.

Thanks,

Jim
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Calling a 3rd party COM Object

XCHARGE-HANDLE must defined as the specific type of activex handle, such as:

01 XCHARGE-HANDLE HANDLE OF @XCeXpressLink.

That should do it.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Calling a 3rd party COM Object

Thanks ROBSTAN, that cleared all of my errors and I will run a test to see if this works.

Is there any better docs on this type of issue?

Thanks again for your help and I will be trying to get the next method to work later, ExecuteXCClient, and I might need a bit more help!
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Calling a 3rd party COM Object

I don't know of any other resources other than the Acucorp doc and various examples that are on the website and release media. In the past, Acucorp has offered classes on ActiveX/COM/Windows API. You may check with your account manager and see if any are coming up. I've attended and they are worth it.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.