(火急)通过jacob调用COM组件出现的问题!
请教在JSP中调用COM组件,提示错误:com.jacob.com.ComFailException: Invoke of: SetResizeTo
Source:
如果注释了Dispatch.call(obx, "SetResizeTo", newwidth , newheight ) ;
则出现错误:com.jacob.com.ComFailException: Invoke of: SaveJpgToFile
Source:
如果再注释Dispatch.call(obx, "SaveJpgToFile", imgto , mass ) ;
则出现错误:com.jacob.com.ComFailException: A COM exception has been encountered:
At Invoke of: Close
Description: An unknown COM error has occured.
请问是哪里的错误啊,这个组件可是没问题的,救救我吧。。。。。。。。
<%@ page contentType="text/html; charset=GBK" language="java" %>
<%@ page import="com.jacob.activeX.*" %>
<%@ page import="com.jacob.com.*" %>
<%
Variant imgfile = new Variant("E:\\DK.jpg");
Variant imgto = new Variant("E:\\1.jpg");
Variant modnum = new Variant(2);
Variant newwidth = new Variant(400);
Variant newheight = new Variant(500);
Variant mass = new Variant(100);
ActiveXComponent obx = new ActiveXComponent("abcOdb.abcOdbObject");
Dispatch.call(obx, "SetLoadImage", imgfile , modnum ) ;
Dispatch.call(obx, "SetResizeTo", newwidth , newheight ) ;
Dispatch.call(obx, "SaveJpgToFile", imgto , mass ) ;
Dispatch.call(obx,"Close") ;
objImage =null;
%>
COM在ASP中的说明:
<%
Set obx=Server.CreateObject("abcOdb.abcOdbObject") '创建Com对象
obx.SetLoadImage "E:\DK.jpg",2
'载入图片,参数为:图片绝对路径和载入模式
obx.SetResizeTo 400,500
'改变图片到新的大小,参数为新的图像宽度和图像高度
bolResult=obx.SaveJpgToFile("E:\1.jpg",100) '设置输出的图片保存位置和质量
obx.Close '关闭与释放本组件资源
Set obx = nothing '清空组件对象
%>