Java调用OCX控件

try {

String url = "D:\\seit\\"+id;

ActiveXComponent com = new ActiveXComponent("CLSID:B40D2D79-3C74-4615-9F6D-A0DD52839E2A");

Dispatch disp = (Dispatch) com.getObject();

boolean cod = Dispatch.call(disp, "CreatePublishDog",url,enddate,startdate,Integer.parseInt(number)).toBoolean();

if(!cod){

return "1";//System.out.println("出错了");

}

while (true)

{

String strMsg = Dispatch.call(disp, "GetCreatePublishDogMsg").toString();

String getDog = Dispatch.call(disp,"GetDogIDList").toString();

System.out.println(strMsg);

int nProgress = Dispatch.call(disp, "GetCreatePublishDogProgress").toInt();

if(Dispatch.call(disp, "bEndCreatePublishDog").toBoolean()){

boolean bErr = Dispatch.call(disp, "bCreatePublishDogError").toBoolean();

if (bErr){

return "2";//System.out.println("出错了");

}else{

System.out.println("制作完毕");

return getDog;//System.out.println("制作完毕");

}

}

Thread.sleep(1000);

}

} catch (Exception e) {

e.printStackTrace();

}  

return "";//

}

你可能感兴趣的:(java)