日期:2014-05-19 浏览次数:20879 次
import jp.ne.so_net.ga2.no_ji.jcom.IDispatch; import jp.ne.so_net.ga2.no_ji.jcom.ReleaseManager; public class CallDll { public static void main(String[] args) { Process(); } public static String Process() { ReleaseManager rm = new ReleaseManager(); try { IDispatch vbcom = new IDispatch(rm, "U8Distribute.iDistribute"); Object[] param = new Object[] { "XXXXX" }; String strRet = (String) vbcom.method("Process", param); System.out.println("return: " + strRet); } catch (Exception e) { e.printStackTrace(); } finally { rm.release(); } return null; } }
jp.ne.so_net.ga2.no_ji.jcom.JComException: createInstance() failed HRESULT=0x800401F3L at jp.ne.so_net.ga2.no_ji.jcom.IDispatch._create(Native Method) at jp.ne.so_net.ga2.no_ji.jcom.IDispatch.create(IDispatch.java:84) at jp.ne.so_net.ga2.no_ji.jcom.IDispatch.<init>(IDispatch.java:46) at com.dcec.call.dll.CallDll.Process(CallDll.java:14) at com.dcec.call.dll.CallDll.main(CallDll.java:8)
ReleaseManager rm = new ReleaseManager(); String res = null; try { IDispatch vbcom; vbcom = new IDispatch(rm, "U8Distribute.iDistribute"); Object[] param = new Object[] { *** }; res = (String) vbcom.method("Process", param); } catch (JComException e) { e.printStackTrace(); throw new Exception("Jcom调用发生异常" + e.getMessage()); } finally { rm.release(); } return res;