Creating the Setup Program

Included with this SDK is an example setup program that you can use as a model for your application. The setup program, called Dinstall and located in the \Dxsdk\Sdk\Samples\Setup directory, demonstrates how to load a sample program called Rockem in a selected directory. It also demonstrates one way to configure the DirectXSetup function.

The following steps describe how you can modify the Dinstall.c program to work for your application:

1In an editor, open Dinstall.c.

2You need to provide a list of your application's files that you want to load on a user's system. To modify the list in the Dinstall.c file to fit your application's needs, search for "copy_list", and then change the list of files in this structure to the list of files for your application.

Dinstall installs files only in the default directory. If you want some of your application's files to be installed in a subdirectory, you need to modify Dinstall.c.

3The Dinstall.c program does not determine whether enough free hard disk space is available on the user's system to successfully install your application. You should, however, add this functionality by writing your own code. To find the two locations in the Dinstall.c file to insert this code, search for "IDS_DISK_MSG".

4The lpszRootPath parameter of DirectXSetup specifies the path to the Dsetup*.dll files (Dsetup.dll, Dsetup6e.dll, Dsetup6j.dll, Dsetupe.dll, and Dsetupj.dll) and the Directx directory on your distribution media. These dynamic-link libraries and this directory should be located in the same directory as the Dinstall executable (after it is compiled), unless there is an overwhelming reason to do otherwise. If all these files and directories are located in the same directory, the value of the lpszRootPath parameter should be set to NULL. This ensures that if the path changes when the files are placed on a compact disc or floppy disks from the root of the application, DirectXSetup will still function properly.

For example, suppose Dinstall.exe, Dsetup*.dll, and the Directx directory are located in an application directory called D:\Funstuff during the testing phase. Then, when you burn the files on a compact disc, suppose you put them in the root. If the lpszRootPath parameter is set to "\FUNSTUFF", the setup program (Dinstall.exe) will not function from the compact disc. However, if the lpszRootPath parameter is set to NULL, the setup program will function in both cases, because the path to Dsetup*.dll, and the Directx directory are still in the current directory.

If you decide to place the Dsetup*.dll files and the Directx directory somewhere other than in the directory that contains Dinstall.exe, you must pass the correct parameters to DirectXSetup and load Dsetup.dll correctly. The lpszRootPath parameter of DirectXSetup should contain the full path to Dsetup.dll. In addition, you need to use the LoadLibrary and GetProcAddress Win32® functions in your setup program to locate Dsetup.dll.

The content of the Setup dialog box is determined by data supplied in the Dinstall.rc resource file. To display your application's name and graphics, make the following changes to this resource file:

1In an editor, open Dinstall.rc.

2Search for all occurrences of "Rockem" and change them to the name of your application.

3The graphics that are displayed in the Setup and Reboot dialog boxes are called Signon.bmp and Reboot.bmp in the resource file. You can either name your bitmap files these names, or you can change the names in the resource file to match the names of your bitmaps.

4The icon for the Dinstall executable is called Setup.ico in the resource file, and it is specified by SETUP_ICON. You can either name your icon file Setup.ico, or you can change the name in the resource file to match the name of your icon file.

5Optionally, you can change the default directory your application is installed in. To do this, search for "IDS_DEFAULT_GAME_DIR" (it is located in two places in the resource file) and change the path of the default directory.

After you have modified the Dinstall.c and Dinstall.rc files to fit your application's needs, you can compile them into the Dinstall.exe executable. You can also rename this executable (to Setup.exe, for example).