Simple example of developing and deploying ActiveX controls using ATL

Source: Internet
Author: User

Write an ATL component, add a simple class, and add BEGIN_CATEGORY_MAP (CAirlineInfo) to the Class header file)
IMPLEMENTED_CATEGORY (CATID_SafeForScripting)
IMPLEMENTED_CATEGORY (CATID_SafeForInitializing)
END_CATEGORY_MAP ()
Then introduce the header file (# include <objsafe. h>) required by the above Code to stdafx. h. Add a method to the class and call the WinExec () function. Check the zqcom project.
To publish a file online, you need to package the dependent file as. cab, including the dll of the component, the library that the dll depends on, and an inf file. In my example, the content of the inf file is as follows:
[Version]
Signature = "$ CHICAGO $"
AdvancedINF = 2.0
[Add. Code]
Zqcom. dll = zqcom. dll
Msvcr71d. dll = msvcr71d. dll
[Zqcom. dll]
File-win32-x86 = thiscab
Clsid = {CB4C551D-2BF5-40F7-866B-922DBEA618F2}
FileVersion = 1, 0, 0
RegisterServer = yes
[Msvcr71d. dll]
File-win32-x86 = thiscab
RegisterServer = yes
The content of [version] is fixed; [Add. code] For the content to be added, zqcom. dll is the component to be added, msvcr71d. dll is zqcom. dll dependent Library (I use. is msvcr71d. dll, if the component written in vc6.0 is mfc42.dll); [zqcom. dll] contains some information. clsid corresponds to the CLSID of the class.
Note: Because the component is not signed, you need to reduce the security settings when accessing the client. In attribute security, change the internet and intranet settings to allow running of unsigned activex components, it should be back after installation.
Method for packaging. cab:
On the command line, enter:
CABARC n e: \ myinf. cab e: \ zqcom. dll e: \ msvcr71d. dll e: \ test. inf
Place the generated. cab in the corresponding location, and my cab in: c: \ Inetpub \ wwwroot. If cabarc is not running, search on the machine and add it to the Environment path. Everything is OK.

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.