How PHP invokes the OCX control

Source: Internet
Author: User

Need to set up the php.ini file, find this line com.allow_dcom=true, put COM component support enabled

using PHP to invoke the OCX control, this is not a problem, but in reality, the use of Flash avoidance method is more general. The real use of OCX is not much, and the data is relatively small, from the Internet to see a successful example:

Actually call OCX or whatever the control file contains in

Include ("D:\wwwroot\Authen\Authen. OCX");

It then calls it with a COM function where the argument is with the file name . This is called by the form of the class name as important

$word = New COM ("Authen.cauthenctrl") or Die ("Unable to instanciate word");

It is so simple to complete the work of the PHP call Control ~ ~ ~ ~ ~ ~ ~ ~


I am an ActiveX control made with MFC,
Generates a authen. PHP inside references first
Include ("Authen. OCX 's physical path ");
$myCom = new COM ("Authen.cauthenctrl") or Die ("Unable to instanciate Word");
Authen is the file name
Cauthenctrl is the class name

Source: http://blog.chinaunix.NET/uid-22414998-id-113455.html


Found from the manual.
Start Word
$word = new COM ("Word.Application") or Die ("Unable to instanciate word");
Print "Loaded Word, Version {$word->version}\n";

Before placing it
$word->visible = 1;

Open an empty document
$word->documents->add ();

Do something, whatever.
$word->selection->typetext ("This is a test ...");
$word->documents[1]->saveas ("Useless test.doc");

Close Word
$word->quit ();

Releasing objects
$word->release ();
$word = null;

How PHP invokes the OCX control

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.