Write an ATL component, add a simple class, and add in the class header file:BEGIN_CATEGORY_MAP(CAirlineInfo)
IMPLEMENTED_CATEGORY(CATID_SafeForScripting)
IMPLEMENTED_CATEGORY(CATID_SafeForInitializing)
END_CATEGORY_MAP()
The header file (#include <objsafe.h>) required by the above code is then introduced to stdafx.h. Then in the class casually add a method call WinExec () function OK, see zqcom Engineering.
Publishing on the web requires that the dependent files be packaged as. cab, which includes the Dll,dll dependent libraries and an INF file for the component. The contents of the INF file in my example are 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,0
RegisterServer=yes
[msvcr71d.dll]
file-win32-x86=thiscab
RegisterServer=yes
The contents of [version] are fixed, [Add.Code] is for the content to be added, Zqcom.dll is the component to be added, Msvcr71d.dll is a dependent library of Zqcom.dll, (I'm using. NET, so it's msvcr71d.dll, if the vc6.0 is Mfc42.dll), [Zqcom.dll] is some information, and the CLSID corresponds to the CLSID of the class.
Note: Because the component is not signed, the client accesses the security settings, and the Internet and intranet settings are changed to allow unsigned ActiveX components to run in property security, and should be back after installation.
How to package. cab:
At 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 position, and my cab is placed under: c:\Inetpub\wwwroot\. If the CABARC is not running, then search the machine, then add the environment path, all OK.
This article supporting source code