Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

How To Package ATL Controls for Use Over the Internet


View products that this article applies to.

This article was previously published under Q249233

↑ Back to the top


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.

↑ Back to the top


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]
; version signature (same for both NT and Win95) do not remove
signature="$CHICAGO$"
AdvancedINF=2.0


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


; 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   
; *** add your control's CLSID here ***
clsid={F7259634-1013-40DB-A4D3-CD1308A0AA66}
; *** add your control's file version here.   
FileVersion=1,0,0,1
RegisterServer=yes   


; dependent DLLs

; this section is not necessary if you built your project as MinDependency
[atl.dll]
; 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
FileVersion=3,0,8168,0
; This is an example of conditional hook. The hook only gets processed
; if atl.dll of the specified version is absent on client machine.
hook=ATLinstaller   

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

↑ Back to the top


References

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.

↑ Back to the top


Keywords: KB249233, kbhowto, kbfile, kbfaq, kbdocfix, kbctrlcreate, kbctrl

↑ Back to the top

Article Info
Article ID : 249233
Revision : 4
Created on : 7/15/2004
Published on : 7/15/2004
Exists online : False
Views : 644