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.