home *** CD-ROM | disk | FTP | other *** search
/ Mega Dittos - The Screensaver / megadittos.iso / dittos / wfsound.mst < prev    next >
Text File  |  1994-07-03  |  19KB  |  797 lines

  1. '**************************************************************************
  2. '*                     Wired for Sound Install Script
  3. '*     version 1.1   by Aaron Wallace  (c) 1993 Aristosoft, Inc
  4. '**************************************************************************
  5.  
  6. '$INCLUDE 'setupapi.inc'
  7. '$INCLUDE 'msdetect.inc'
  8.  
  9. ''Dialog ID's
  10. CONST WELCOME      = 100
  11. CONST ASKQUIT      = 200
  12. CONST DESTPATH     = 300
  13. CONST EXITFAILURE  = 400
  14. CONST EXITQUIT     = 600
  15. CONST EXITSUCCESS  = 700
  16. CONST WHICHINST    = 800
  17. CONST APPHELP      = 900
  18. CONST WHICHINSTHLP = 910
  19. CONST SETOWNER     = 1000
  20. CONST TESTSOUND    = 1100
  21. CONST INSTALLDRV   = 1200
  22. CONST SOUNDPLAYED  = 1300
  23. CONST WAITDLG      = 1400
  24. CONST EXITREBOOT   = 1500
  25. CONST BBD1         = 5000
  26. CONST BBD2         = 5010
  27. CONST BBD3         = 5020
  28. CONST BBD4         = 5030
  29. CONST BBD5         = 5040
  30. CONST BBD6         = 5050
  31. CONST SOUNDSDLG    = 5200
  32. CONST TAPPSDLG     = 5300
  33. CONST VOICESDLG    = 5400
  34. CONST CUSTINST     = 6200
  35. CONST TOOBIG       = 6300
  36. CONST BADPATH      = 6400
  37.  
  38. '' For message boxes
  39. CONST MB_YESNO=4
  40. CONST MB_RETRYCANCEL=5
  41. CONST IDNO=7
  42. CONST IDYES=6
  43. CONST IDRETRY=4
  44. CONST IDCANCEL=2
  45.  
  46. ''Bitmap ID
  47. CONST LOGO         = 1
  48.  
  49. ''File Types
  50. CONST BASEFILES     = 1
  51. CONST TAPPFILES     = 2
  52. CONST SOUNDFILES    = 3
  53. CONST VOICEFILES    = 4
  54. CONST MAX_TYPES     = 4
  55.  
  56. ''Install directories, etc.
  57. GLOBAL DEST$        ''Default destination directory.
  58. GLOBAL WINDRIVE$    ''Windows drive letter.
  59. GLOBAL CUIDLL$      ''CUI DLL
  60. GLOBAL WINDIR$      ''Windows directory
  61. GLOBAL SYSDIR$      ''System directory
  62. GLOBAL WININI$      ''"win.ini"
  63. GLOBAL SYSINI$      ''GetWindowsDir() + "system.ini"
  64.  
  65. '' User info
  66. GLOBAL OWNER$       '' Product registered owner
  67. GLOBAL WORKPLACE$   '' Company or such
  68.  
  69. ''Install item lists
  70. GLOBAL BASE$        ''List of base files
  71. GLOBAL TAPPS$       ''List of all talking apps
  72. GLOBAL SOUNDS$      ''List of all sounds.
  73. GLOBAL VOICES$      ''List of available voices
  74.  
  75. GLOBAL BASEINST$    ''List of base files to install
  76. GLOBAL TAPPSINST$   ''List of Talking Apps to install
  77. GLOBAL SOUNDSINST$  ''List of sounds to install
  78. GLOBAL VOICESINST$  ''List of voices to install
  79.  
  80. ''Custom Install list symbol names
  81. GLOBAL BASENEEDS$   ''Option list costs per drive
  82. GLOBAL TAPPNEEDS$
  83. GLOBAL SOUNDNEEDS$
  84. GLOBAL VOICENEEDS$
  85. GLOBAL EXTRACOSTS$  ''List of extra costs to add per drive
  86.  
  87. ''Custom Install dialog list symbol names
  88. GLOBAL CHECKSTATES$ ''List of check box values
  89. GLOBAL STATUSTEXT$  ''List of values to initialize status items
  90. GLOBAL DRIVETEXT$   ''Drive space info, etc.
  91.  
  92. '' Install DSOUND
  93. GLOBAL INSTDSOUND%
  94.  
  95. '' Customize product
  96. GLOBAL CUSTOMIZE%
  97.  
  98. '' Test sound hardware
  99. GLOBAL DOTEST%
  100.  
  101. GLOBAL WFSFOUND%
  102. GLOBAL CUSTINSTALL%
  103.  
  104. '' Which type of install to perform, by default
  105. GLOBAL DEFINSTOPT$
  106.  
  107. ''Win.ini [Aristosoft] install code
  108. GLOBAL INSTDIR$
  109.  
  110. ''Space requirements
  111. GLOBAL FITS%        '' > 0 if everything fits
  112.  
  113. DECLARE SUB RecalcOptFiles (ftype%)
  114. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  115. DECLARE FUNCTION GetWindowsVersionCorrectly& ()
  116. DECLARE FUNCTION MakeVer& (x as integer, y as integer)
  117. DECLARE FUNCTION StringInList (s$, y$) AS INTEGER
  118. DECLARE FUNCTION sndPlaySound LIB "MMSYSTEM.DLL" (f$, fl%) AS INTEGER
  119. DECLARE SUB RemoveSectionFiles (dest$, sect$)
  120. DECLARE SUB RemDirectory (d$)
  121. DECLARE FUNCTION HasSoundDriver() AS INTEGER
  122. DECLARE SUB SendProgmanCommand LIB "CUI.DLL" (s$)
  123. DECLARE SUB KillFiles LIB "CUI.DLL" (s$)
  124. DECLARE SUB KillFile LIB "CUI.DLL" (s$)
  125. DECLARE FUNCTION GetModuleHandle LIB "KERNEL" (f$) AS INTEGER
  126.  
  127. DECLARE SUB Ctl3dRegister LIB "WFSUI.DLL" (f%)
  128. DECLARE SUB Ctl3dAutoSubclass LIB "WFSUI.DLL" (f%)
  129. DECLARE SUB Ctl3dUnregister LIB "WFSUI.DLL" (f%)
  130.  
  131.  
  132. '' These are defined in wfs.inc (product-specific)
  133. DECLARE SUB SetProductTitles
  134. DECLARE FUNCTION InfFile() AS STRING
  135. DECLARE FUNCTION MakeInstDir(D$) AS STRING
  136. DECLARE SUB AddInfSectionNames (BASE$, TAPPS$, SOUNDS$, VOICES$, BASEINST$, TAPPSINST$, SOUNDSINST$, VOICESINST$)
  137. DECLARE SUB RecalcPath
  138. DECLARE SUB AddOptFilesToCopyList (ftype%)
  139. DECLARE SUB SetDriveStatus
  140. DECLARE SUB AddOptFiles
  141. DECLARE SUB ConfigureApps
  142. DECLARE SUB AddBillboards
  143. DECLARE SUB DoUninstall
  144.  
  145.  
  146. '' This is where it all begins!
  147.  
  148. INIT:
  149.  
  150.     CUIDLL$ = "cui.dll"
  151.     DEFINSTOPT$ = "1"
  152.     INSTDSOUND% = 0
  153.     CUSTOMIZE% = -1
  154.     DOTEST% = -1
  155.  
  156.     SetProductTitles
  157.  
  158.     HELPPROC$ = "FHelpDlgProc"          ''Help dialog procedure
  159.  
  160.     SetBitmap CUIDLL$, LOGO
  161.  
  162.  
  163. '' We don't do Windows 3.0...
  164.  
  165.     If GetWindowsVersionCorrectly() < MakeVer(3, 10) Then
  166.     i% = DoMsgBox("This product requires Windows version 3.10 or greater", "Setup", MB_OK)
  167.     GOTO DONEFINIFIN
  168.     End If
  169.  
  170. '' We don't want these DLLs to be loaded quite yet...
  171. LookAround:
  172.     IF GetModuleHandle("SNDAPI") OR GetModuleHandle("WFSABOUT") THEN
  173.     i% = DoMsgBox("Please quit all other Aristosoft products before continuing with Setup.", "Setup", MB_RETRYCANCEL)
  174.     IF i% = IDRETRY THEN
  175.         GOTO LookAround
  176.     ELSEIF i% = IDCANCEL THEN
  177.         GOTO DONEFINIFIN
  178.     END IF
  179.     END IF
  180.  
  181.     HCUI% = GetModuleHandle("CUI")
  182.     Ctl3dRegister(HCUI%)
  183.     Ctl3dAutoSubclass(HCUI%)
  184. ''Find location of INF file and create a default dest. dir
  185.  
  186.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  187.     IF szInf$ = "" THEN
  188.     szInf$ = GetSymbolValue("STF_CWDDIR") + InfFile()
  189.     END IF
  190.  
  191.     '' Load the INF file
  192.     ReadInfFile szInf$
  193.  
  194.     '' Construct default strings
  195.     WINDIR$ = GetWindowsDir()
  196.     SYSDIR$ = GetWindowsSysDir()
  197.     WININI$ = "win.ini"
  198.     SYSINI$ = MakePath(WINDIR$, "system.ini")
  199.  
  200.     '' Construct the default install path
  201.     WINDRIVE$ = MID$(WINDIR$, 1, 1)
  202.     DEST$ = MakeInstDir(WINDRIVE$)
  203.  
  204.     '' Setup install symbols
  205.     BASE$ = "Base Files"
  206.     TAPPS$ = "Talking Apps"
  207.     SOUNDS$ = "Sounds"
  208.     VOICES$ = "Voices"
  209.     BASEINST$ = "Base Files Inst"
  210.     TAPPSINST$ = "Talking Apps Inst"
  211.     SOUNDSINST$ = "Sounds Inst"
  212.     VOICESINST$ = "Voices Inst"
  213.  
  214.     SetSymbolValue BASE$, ""
  215.     SetSymbolValue TAPPS$, ""
  216.     SetSymbolValue SOUNDS$, ""
  217.     SetSymbolValue VOICES$, ""
  218.  
  219.     ''Set up symbols for the initial install dialog
  220.     RADIODEFAULT$ = "Radio Default"
  221.  
  222.     ''Set up symbols for the custom install dialog
  223.     CHECKSTATES$ = "CheckItemsState"
  224.     STATUSTEXT$  = "StatusItemsText"
  225.     DRIVETEXT$   = "DriveStatusText"
  226.     FOR i% = 1 TO 4 STEP 1
  227.     AddListItem CHECKSTATES$, "ON"
  228.     NEXT i%
  229.     FOR i% = 1 TO 4 STEP 1
  230.     AddListItem STATUSTEXT$, ""
  231.     NEXT i%
  232.     FOR i% = 1 TO 7 STEP 1
  233.     AddListItem DRIVETEXT$, ""
  234.     NEXT i%
  235.     ReplaceListItem DRIVETEXT$, 7, DEST$
  236.  
  237.     ''Disk cost list symbols
  238.     BASENEEDS$   = "BaseNeeds"
  239.     TAPPNEEDS$   = "TAppNeeds"
  240.     SOUNDNEEDS$  = "SoundNeeds"
  241.     VOICENEEDS$  = "VoiceNeeds"
  242.     EXTRACOSTS$  = "ExtraCosts"
  243.     FOR i% = 1 TO 26 STEP 1
  244.     AddListItem EXTRACOSTS$, "0"
  245.     NEXT i%
  246.  
  247.     ''Configure lists of installable files
  248.     AddInfSectionNames BASE$, TAPPS$, SOUNDS$, VOICES$, BASEINST$, TAPPSINST$, SOUNDSINST$, VOICESINST$
  249.  
  250. '$IFDEF DEBUG
  251.     i% = SetSizeCheckMode(scmOnIgnore)    '' could use scmOff; def = scmOnFatal
  252. '$ENDIF ''DEBUG
  253.  
  254.  
  255. '' Display Welcome dialog
  256. WELCOME:
  257.     sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$)
  258.     
  259.     IF sz$ = "EXIT" THEN
  260.     GOSUB ASKQUIT
  261.     GOTO WELCOME
  262.     ELSEIF sz$ = "CONTINUE" THEN
  263.     UIPop 1
  264.     GOTO WHICHINST
  265.     END IF
  266.     GOTO WELCOME
  267.  
  268.  
  269. '' See if users want an easy install, custom install, or no install...
  270. WHICHINST:
  271.     SetSymbolValue "RadioDefault", DEFINSTOPT$
  272.     sz$ = UIStartDlg(CUIDLL$, WHICHINST, "FRadioDlgProc", WHICHINSTHLP, HELPPROC$)
  273.     
  274.     ''sz$ is the button the user pressed; RADIODEFAULT$ is the option selected
  275.  
  276.     IF sz$ = "EXIT" THEN
  277.     GOSUB ASKQUIT
  278.     GOTO WHICHINST
  279.     ELSEIF sz$ = "CONTINUE" THEN
  280.     sz$ = GetSymbolValue("ButtonChecked")
  281.     IF sz$ = "1" THEN
  282.         UIPop 1
  283.         CUSTINSTALL% = 0
  284.         GOTO CUSTOMIZE
  285.     ELSEIF sz$ = "2" THEN
  286.         UIPop 1
  287.         CUSTINSTALL% = -1
  288.         GOTO CUSTOMIZE
  289.     ELSEIF sz$ = "3" THEN
  290.         DoUninstall
  291.         GOTO WHICHINST
  292.     END IF
  293.     END IF
  294.     G