|
-
December 6th, 2010, 06:02 PM
#3
Re: How to implement BSTR in Java
 Originally Posted by keang
I don't understand what you mean. Are you trying to provide a Java implementation of the C++ code or are you trying to call the C++ code from your Java code.
Hello Keang,
I am just trying to do a java implementation of the C++ code, i want to write the same function in Java too. I am not calling any Cpp code
Unfortunately the Java code you have shown makes little sense unless you show/explain what a JIString is and what object type 'dispatch' is and what it's callMethod() method does.
Forget about the code, my aim is to implement the same function in Java too. In the JI is J-Interop "http://j-interop.org/".
JISession session = null;
IJIComObject sysInfoObject = null;
IJIComObject sysInfoServer = null;
IJIDispatch dispatch = null;
String identifier = null;
ControlSoft2(String[] args) throws JIException, UnknownHostException
{
session = JISession.createSession("localhost", "username", "password");
session.useSessionSecurity(true);
JIComServer comServer = new JIComServer(JIProgId.valueOf("application prog ID"), "localhost",session);
sysInfoServer = comServer.createInstance();
sysInfoObject = (IJIComObject)sysInfoServer.queryInterface("Com server inetrface");
dispatch = (IJIDispatch)JIObjectFactory.narrowObject(sysInfoObject.queryInterface(IJIDispatch.IID));
}
private void PerformOp() throws JIException
{
JIString outStr = new JIString("");
dispatch.callMethod("GetActiveProjectName", new Object[]{outStr});
System.out.println("Out String = "+outStr.toString();
}
Now i have registered my interface into the dispatch object, i am just trying to call a method "GetActiveProjectName" from my com interface.
My question is:
Now i just have to call my function GetActiveProjectName(/*([out]*/ BSTR* nameOfProject) with a BSTR pointer which is an output parameter.
How can i implement this in Java? Do i ahve to use CallBuilder? or use some other pointers etc.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|