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