Deploying Applications with Visual C++ 6.0n

Create Setup Program

Two steps to deployment; first transfer files to users hard disk, second configure users computer to recognise and correctly execute program. These steps should be automated - users are used to applications that have installation programs.


Installation program always called setup to conform to convention and enable the add/remove applet to recognise it. If application distributed on several disks the setup program should reside on first - ease finding it. Typical services provided include:

Users should only need to select installation option and insert media. Recommended installation options:

Silent required for systems managers who may wish to install across a network.


Uninstall Conventions

Apps should safely remove all traces of their presence, but not any user generated files. Typically carried out by program called Uninstall or Uninst - sometimes setup written to also act as uninstaller. Name of application more flexible as name and location stored in system registry (to enable add/remove applet to operate).

Prerequisite for Windows compliance logo.

Rarely matter of deleting all files in subdirectory. Have to handle shared resources and registry modifications. Must not delete components other apps rely on - determine by checking usage count for it in registry.

Registry Information

User preference data to HKEY_CURRENT_USERSOFTWARE_CompanyNameProductNameVersion_, application wide to HKEY_LOCAL_MACHINESOFTWARE_CompanyNameProductNameVersion_ (italicised dependent on app).


Running app has own PATH environment variable. Apps normally stored in unique directories so path o apps components must be stored in app-specific PATH string.

To register a PATH write desired value to HEKY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionApp Paths key. Create key with name same as application, default value contains fully qualified app location (e.g. C:ProgsMyApp.exe) and Path value contains required directories.

Usage Counts

For each shared module installed setup program should consult registry and increment corresponding usage count. When application removed the count should be decremented, if count becomes zero file may be removed (only after asking user).

Cabinet Files

File containing several other compressed files. Setup reads .cab file, decompresses it and writes result to users hard drive. Can be digitally signed to identify creator and ensure file not tampered with.

Made with MakeCab which creates compressed disk images for use with setup programs. CabArc is console-based utility to create and extract cabinet files. Both available from SDK.

Registry Files

ASCII script listing keys and values to add to registry. Any hard coded paths in the file can causes problems - if application installed to different location than that specified in file will result in problems -> setup program may need to edit .reg file before using it.

Can use regedit to import .reg files into registry.


Supplied with Professional and Enterprise versions of VC.

Manages install / uninstall (don't need to write latter as is generic tool that reads log file created during setup).

Categorises application into different groups, each containing files relevant to group.

InstallShield scans application folder to determine project dependencies and ships these files in addition to those present in the application folder.

Registering COM Components

In order for COM / ActiveX component to execute registry must be updated to include controls GUID, its location, characteristics (threading model, etc.) and operation information (is it visible, activated inside container, etc.).

ActiveX controls are self-registering - update registry information themselves. Relieves this task from setup program. Other COM components may require the use of .reg files, etc. to achieve their registration.

Invocation of self-registration behaviour achieved by calling DllRegisterServer() entry point on DLL. Normally handed by IE or Setup program (depending on if component downloaded via web or received as part of installation package). Can also use system tool - RegSvr32.exe.

Counterpart to remove control from registry handled by DllUnregisterServer().

To get InstallShield to call registration function must place all self-registering components in own file group with the Self Registered property set.

Deployment Options


Disks and CD-ROMS cost effective and convenient. 3.5 inch ubiquitous.

Often used to distribute upgrades - bug correction through new versions. Upgrades should include setup program that installs revised files.


Least expensive. Ideal if app only to serve a set of users linked by LAN or WAN. Disk images placed on network resource available to relevant users.


Increasingly common. Has following advantages:

Time-trial evaluation software popular form of deployment. Users download working version of program for free to try for a specified period. If like users can purchase license that will provide, via email, an unlock code so app can be used indefinitely.

Web excellent method of distributing upgrades. Upgrades placed in password protected (known only to registered users) location which users can periodically check for upgrades.


Deploying ActiveX Controls

Control Dependencies

If control has dependencies these should be shipped with it. MFC based controls require presence of MFC42.dll. ATL projects can be constructed in such a fashion so as not to require MFC or C runtime DLLs.

If developing group of ATL controls designed to work together may be better to compile with MinSize option and not MinDependency. Produces considerable reduction in footprint but means ATL.DLL must be present.

Digital Signing

Browsers can require controls to be signed before they will be downloaded. Signatures prove that:

Obtain digital signature from certifying authority. They validate your identity and issue certificate containing digital signature.

Licensed Controls

If control is licensed the installation program should handle requirements automatically. Control Wizard generates license file (license.txt) that should be placed in same directory as control. If your control makes use of registry for licensing information then ensure the setup program creates appropriate entries.

Design-time license protection used when developers attempt to use control. If license file not present then when attempt made to insert control into dialog box, etc. Visual C++ will display message informing developer to purchase license.

Run-time license protection used after developers finish with your control. At run-time container passes keyword to control providing proof that license existed during development - consequently license not required on end-users system.

Making ActiveX Control Internet Friendly

Reduce Size

First time page viewed containing control it must be downloaded by browser. Minimise size to reduce download time.

Avoid using C run-time - reduces executable size and removes need for MSVCRT.DLL. Tips to avoid CRT:

Load data asynchronously

Control can become active while browser continues to receive downloaded properties in background. For example, control showing video should not wait for entire clip to be downloaded. Start displaying data already available, using worker thread to continue to receive file in background.

Miscellaneous Items

Zero Administration for Windows

Initiative to reduce costs associated with networked corporate environments. Facilitate management of users, software and hardware without need for administrators to touch individual machines.


Automatic Update and Installation

Installation and maintenance normally labour-intensive + error-prone. ZAW simplifies by automation. Windows automatically updates itself with new components when they become available. Systems can be configured to boot-up with minimal configuration and check for new sw, etc.

Cache Data and Configuration

Storing information in registry can be problematic in networked environment where users are mobile between machines. ZAW permits user data to be reflected to servers - allows users to log on to other machines and work within the context of their normal host machine. Data and configuration information following user referred to as persistent caching.

Central Administration

To prevent users installing software, changing settings, etc. the network administrator can hide devices such as hard disks, etc. Users presented with single drive letter representing home directory.

Windows Installer

Most important part of ZAW. Automates application installation across network. Benefits over traditional installers include:

Windows Installer not single program, but collection of services.

Systems Management Server

Continually inventories computers on network. Software and hardware detected on machines stored in SQL database through which network administrator has up-to-date inventory of all computers in organisation.

Makes software deployment more efficient. Setup programs can check SMS before deployment, install only on those meeting set of criteria and flagging those not meeting requirements.

Zero Administration Kit

Integral part of Windows 2000, many features already available for NT 4.