Microsoft KB Archive/249233

From BetaArchive Wiki
Knowledge Base

How To Package ATL Controls for Use Over the Internet

Article ID: 249233

Article Last Modified on 7/15/2004


  • 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


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.


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 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 file on the Microsoft site. If you don't want your users to go over the Internet you can place the 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 (same for both NT and Win95) do not remove

;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

; *** add your control's CLSID here ***
; *** add your control's file version here.   

; dependent DLLs

; 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.

; The file actually contains a self extracting executable.
; In this case we specify a run= command


For additional information, click the article number below to view the article in the Microsoft Knowledge Base:

201191 PRB: Registering ATL Server Causes 0x80040154 Error

167158 How To Packaging MFC Controls for Use Over the Internet

244955 PRB: MinDependency Project May Need to Include Atl.dll

For more info on redistributing Visual C++ applications, visit the following Microsoft Web site:

For more information, see the following Webcast:

(c) Microsoft Corporation 1999, All Rights Reserved. Contributions by Kusuma Vellanki, Microsoft Corporation.

Additional query words: atl active control cab

Keywords: kbhowto kbdocfix kbfile kbctrlcreate kbctrl kbfaq KB249233