Code Monkey home page Code Monkey logo

Comments (5)

mpoindexter avatar mpoindexter commented on July 20, 2024 1

If anyone is interested in producing a patch for this: Looks like at a minimum you would have to add support for Holders in native/variant.cpp:convertToVariant() (starts at line 253)

from com4j.

mpoindexter avatar mpoindexter commented on July 20, 2024

Looks like com4j does not handle Holder arguments to IDispatch methods (arguments to an IDispatch method must be variants, and com4j does not currently know how to turn Holders into Variants). If the interface is a dual, then you could try using the non-IDispatch version.

from com4j.

JamaraCP avatar JamaraCP commented on July 20, 2024

I'm having the same problem when I trying to access the VaxSIPUserAgentOCX. I obtain the COMObject, but when I call a method (any method) get the error. I not understand the yours answers and I not know C/C++/C#. Could you explain me better?

StackTrace:
"... 8000ffff Invocation failed: (null) : Catastrophic failure : .\com4j.cpp:82
at com4j.Wrapper.invoke(Wrapper.java:166)
at com.sun.proxy.$Proxy5.setLicenceKey(Unknown Source)
at exercc.testeCOM.main(testeCOM.java:32)".

This is the method in the interface:
@DISPID(2)
boolean setLicenceKey(
java.lang.String licenceKey);

I generate a .IDL in the oleview:

[id(0x00000002)]
VARIANT_BOOL SetLicenceKey(BSTR LicenceKey);

Any help is very wellcome!
Thanks in advance.

from com4j.

mpoindexter avatar mpoindexter commented on July 20, 2024

This is not the same error as above. It comes from the same source line (com4j.cpp:82) because that is the line that catches any errors on the native side of things and translates it to a Java exception.

I do not know what the problem is in your specific instance. It could be a problem with your IDL, a bug in COM4J, a problem in the code you are calling, or incorrect arguments you are passing. Since this is not the same issue, a better place for this question would be the COM4J users mailing list. Given the current activity level on COM4J I wouldn't expect much of a response unfortunately. Sorry to be so unhelpful.

from com4j.

JamaraCP avatar JamaraCP commented on July 20, 2024

Thank you, honestly. You're the first person to answer me.
Here's my method call:

testVax2.wsh._DVaxSIPUserAgentOCX test = (testVax2.wsh._DVaxSIPUserAgentOCX) ClassFactory.createVaxSIPUserAgentOCX();
String key = "Here I insert the license key";
System.out.println("test ("+test+")");
test.setLicenceKey(key); //here the error occurs

It passes a Hex String as argument, that's all. I checked that the bstr type is similar to a String, and the argument from Java IS a String. Could it be the argument, then? It looks like the same type to me. I don't know. I followed the tutorial on http://com4j.java.net/. Sounds easy, it's a simple call, but I can't figure out that error. I've been reading about annotations and the COM4J structure, but it didn't help much. Have you ever used com4j with ocx from third parties? Do you have any example you could show me?
I'll change topics, as you said. You can answer me there, if you wish to do so.

thanks in advance.

from com4j.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.