home *** CD-ROM | disk | FTP | other *** search
- /*
- Example AfterFile
-
- This is a program that sets up a Windows association between files with
- the extension .SVI and the install build program SVI_BLD2.EXE. It also
- shows how to get the dirve and root directory that the user installed
- into. The drive is sent as command line parameter 1 and the directory
- as parameter 2.
-
- It is intended as an example of the AfterFile function of SVInstal.
-
- Under the "Options" section of SVI_BLD2, you can specify a program to be
- run at the end of the installation. This is just one example of what
- might be done by the AfterFile.
-
- Rob Stevens
- Soft Ventures
- (403) 278-1681
- CIS 71441,734
-
- NOTE, this is just an example an is not intended to be a complete treatment
- of the subject of adding associations to Windows. You can edit the WIN.INI
- file to see the association. Feel free to modify this code to meet your
- requirements. If you prefer, Soft Ventures will write a custom AfterFile
- for you for a small fee.
-
- */
-
- #include <windows.h>
- #include <stdio.h>
-
- main(int _argc, char *_argv[])
- {
- BOOL lSuccess;
- char szWinEntry[] = "SVI_BLD2.EXE ^.svi";
- char szMessage[80] = "The user installed into: ";
-
-
- /* Build a string to display what drive and directory the user installed
- into. You might use this information for renaming files after
- installation.
- */
- strcat(szMessage, _argv[1]); // the drive
- strcat(szMessage, ", ");
- strcat(szMessage, _argv[2]); // the directory
-
- MessageBox(0, szMessage, "Sample Afterfile - assoc.exe", MB_OK||MB_ICONINFORMATION);
-
-
-
- /* This program puts an entry in WIN.INI, ".svi SVI_BLD2.EXE ^.svi" under
- the [Extensions] section.
- */
-
- lSuccess = WriteProfileString("Extensions", "svi", szWinEntry);
-
- if (lSuccess)
- MessageBox(0, "Association added successfully",
- "Afterfile updated WIN.INI", MB_OK);
- else
- MessageBox(0, "Association could not be added",
- "Afterfile updated WIN.INI", MB_ICONSTOP);
- }
-
-