您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息
免费发信息

PHP调用OCX控件的具体方法

2024/4/20 16:21:08发布8次查看
需要设置php.ini文件,找到这行com.allow_dcom=true,把com组件支持启用 使用php调用ocx控件,本不是个难题,但现实中采用flash回避的方法更通用。真正使用ocx的不多,而且资料也比较少,从网上看到了一个成功的例子: 其实调用 ocx 文件 和 dll文件是一样的
需要设置php.ini文件,找到这行com.allow_dcom=true,把com组件支持启用
使用php调用ocx控件,本不是个难题,但现实中采用flash回避的方法更通用。真正使用ocx的不多,而且资料也比较少,从网上看到了一个成功的例子:
其实调用 ocx文件 和 dll文件是一样的 首先把欲调用的 目标dll或者ocx或者什么什么的控件文件包含进来
include(d:\wwwroot\authen\authen.ocx);
然后用com函数调用它 其中参数是以 文件名.类名的形式调用的 这点由为重要
$word = new com(authen.cauthenctrl) or die(unable to instanciate word);
就这么简单 就可以完成php调用控件的工作了 ~~~呵呵  ~~~
偶是用mfc做的activex控件,
生成了一个authen.ocx文件,
如果要在php里面引用首先
include(authen.ocx的物理路径);
$mycom = new com(authen.cauthenctrl) or die(unable to instanciate word);
authen是文件名
cauthenctrl是类名
来源:http://blog.chinaunix.net/uid-22414998-id-113455.html
从手册找到的
// 启动 word
$word = new com(word.application) or die(unable to instanciate word);
print loaded word, version {$word->version}\n;
//将其置前
$word->visible = 1;
//打开一个空文档
$word->documents->add();
//随便做些事情
$word->selection->typetext(this is a test...);
$word->documents[1]->saveas(useless test.doc);
//关闭 word
$word->quit();
//释放对象
$word->release();
$word = null;
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录