Microsoft KB Archive/249233

= How To Package ATL Controls for Use Over the Internet =

Article ID: 249233

Article Last Modified on 7/15/2004

-

APPLIES TO


 * Microsoft Internet Explorer 4.0 128-Bit Edition
 * Microsoft Internet Explorer 4.01 Service Pack 2
 * Microsoft Internet Explorer 4.01 Service Pack 1
 * Microsoft Internet Explorer 4.01 Service Pack 2
 * Microsoft Internet Explorer 5.0
 * Microsoft Internet Explorer 5.5

-



This article was previously published under Q249233



SUMMARY
When you embed ActiveX Controls in a Web page using the "OBJECT" tag, the CODEBASE attribute used to specify the download location can point to a .cab file. This .cab file contains an .inf file describing what files are needed for this control to work and where to download them from. This is the recommended way for packaging ActiveX Controls. This article explains how to package ATL controls for use over the Internet.



MORE INFORMATION
If you have built your ATL control with the MinSize build targets, you need to redistribute Atl.dll. There are UNICODE and ANSI versions of Atl.dll, thus you need to install the appropriate version on the target operating system (that is, UNICODE for Windows NT and ANSI for Windows 95 or Windows 98). The easiest way to install ATL.dll is to use the ATL.cab file provided by Microsoft. This .cab file contains an .exe file that installs the correct version depending on the operating system.

As an alternative, do not use Atl.dll. If you rebuild your ATL control as MinDependency, the code in ATL.dll is statically linked to your project. For Internet downloads, we recommend that the developers build with the build target set to MinDependency to avoid redistributing the Atl.dll with their components. This, of course, causes your executable to increase in size but it is minimal and saves time in troubleshooting dependency problems.

The following .inf file shows how to package an ATL control. It points to the Atl.cab file on the Microsoft site. If you don't want your users to go over the Internet you can place the Atl.cab file on your intranet server and change the path for the Atl.dll in your .inf file accordingly.

Also, when packaging components, make sure you use the Depends.exe tool that comes with Visual Studio to determine all the dependencies for your component. Additionally, if you are using LoadLibrary to dynamically load DLLs at run time, make sure you are distributing those as well.

[version] signature="$CHICAGO$" AdvancedINF=2.0
 * version signature (same for both NT and Win95) do not remove

[Add.Code] keyctl.dll=keyctl.dll atl.dll=atl.dll
 * This is the main control
 * Add all your dependent DLLS here, listing most dependent first
 * Note that atl.dll is not necessary if your project is built
 * as MinDependency


 * thiscab is a keyword which, in this case, means that KeyCtl.ocx
 * can be found in the same .cab file as this .inf file
 * file-win32-x86 is an x86 platform specific identifier

[keyctl.dll] file-win32-x86=thiscab clsid={F7259634-1013-40DB-A4D3-CD1308A0AA66} FileVersion=1,0,0,1 RegisterServer=yes
 * *** add your control's CLSID here ***
 * *** add your control's file version here.


 * dependent DLLs

[atl.dll] FileVersion=3,0,8168,0 hook=ATLinstaller
 * this section is not necessary if you built your project as MinDependency
 * This is the version of atl.dll that shipped with VS 6.0 SP3
 * If a newer version is available, update the version number here
 * This is an example of conditional hook. The hook only gets processed
 * if atl.dll of the specified version is absent on client machine.

[ATLinstaller] file-win32-x86=http://activex.microsoft.com/controls/vc/atl.cab run=%EXTRACT_DIR%\atl.exe
 * The atl.cab file actually contains a self extracting executable.
 * In this case we specify a run= command

