简体   繁体   中英

Possible to modify an enum in a third-party ActiveX control?

I am using an ActiveX control from a vendor for a USB device that reads RFID cards.

My application is in java and so I am using EZJCom as a "bridge" - all of the properties and methods of the activeX control are therefore available via java classes.

If I look in windows device manager, the card reader device is on com port COM8 .

Now, the problem occurs because of this enum, which indicates the COM port the device is running on.

typedef enum {
    COM1 = 1,
    COM2 = 2,
    COM3 = 3,
    COM4 = 4
} CommPortConstants;

My Java code can do this:

cardReader.get_DMF5Ax().setCommPort(CommPortConstants.COM4);  // OK

But not this:

cardReader.get_DMF5Ax().setCommPort(CommPortConstants.COM8);  // fails!

In other words, due to the nature of this enum, I can't look for the device (via java calling the ActiveX control) on COM8 .

So for my question: is there a way to "edit" an ActiveX control, and add values to the enum?

Or is there a better way (other than EZJCom) to use activeX controls from java.

Note that I don't have the source code to the ActiveX control, and (coming from the java world) neither am I familiar with the development environments for making them.

I know nothing about EZJCom (and very little about Java for), but from the ActiveX/COM I don't think you should have a problem working it around.

COM methods (and specifically, automation methods) do not get Java Enums. They either get LONG in most cases, and in some cases, they would get VARIANT or type I4.

It looks like CommPortConstants are just constants, so this should work for you:

cardReader.get_DMF5Ax.setCommPort(8)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM