当我运行以下代码时:
JICallBuilder callObject = new JICallBuilder ( true );
callObject.setOpnum ( 1 );
callObject.addInParamAsShort((short)direction.id (), JIFlags.FLAG_NULL);
callObject.addInParamAsString ( position, JIFlags.FLAG_REPRESENTATION_STRING_LPWSTR);
getCOMObject ().call ( callObject );
返回异常
16:05:13.348 [OPCSessionDestructor] DEBUG org.openscada.opc.lib.da.Server - Starting destruction of DCOM session
at org.jinterop.dcom.core.JIComServer.call(JIComServer.java:999)
at org.jinterop.dcom.core.JIComServer.call(JIComServer.java:945)
at org.jinterop.dcom.core.JIComObjectImpl.call(JIComObjectImpl.java:271)
at org.jinterop.dcom.core.JIComObjectImpl.call(JIComObjectImpl.java:156)
at org.openscada.opc.dcom.da.impl.OPCBrowseServerAddressSpace.changePosition(OPCBrowseServerAddressSpace.java:83)
at org.openscada.opc.lib.da.browser.TreeBrowser.moveToBranch(TreeBrowser.java:94)
at org.openscada.opc.lib.da.browser.TreeBrowser.fill(TreeBrowser.java:176)
at com.lakert.opc.OpcClient.connectServer(OpcClient.java:82)
at com.lakert.opc.OpcListener.start(OpcListener.java:21)
at com.lakert.opc.OpcListener.main(OpcListener.java:26)
Caused by: org.jinterop.dcom.common.JIRuntimeException: The parameter is incorrect. [0x80070057]
然后我发现该界面使用oleviewer
HRESULT _stdcall ChangeBrowsePosition(
[in] tagOPCBROWSEDIRECTION dwBrowseDirection,
[in] LPWSTR szString);
typedef enum {
OPC_BROWSE_UP = 1,
OPC_BROWSE_DOWN = 2,
OPC_BROWSE_TO = 3
} tagOPCBROWSEDIRECTION;
第一个参数是枚举类型,但是我在jinterop中找不到枚举类型,那么如何解决这个问题呢?谢谢!