home *** CD-ROM | disk | FTP | other *** search
Wrap
'************************************************************************** '* GCP++ SDK Setup 2.2 '************************************************************************** '$INCLUDE 'setupapi.inc' '$INCLUDE 'msdetect.inc' ''Dialog ID's CONST WELCOME = 100 CONST ASKQUIT = 200 CONST DESTPATH = 300 CONST EXITFAILURE = 400 CONST EXITQUIT = 600 CONST EXITSUCCESS = 700 CONST APPHELP = 900 CONST BADPATH = 6400 CONST IDYES =6 CONST IDNO =7 CONST MB_YESNO=4 CONST MB_DEFBUTTON2 =256 ''Bitmap ID CONST LOGO = 1 GLOBAL DEST$ ''Default destination directory. DECLARE SUB Install DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING DECLARE FUNCTION EditAutoexec LIB "GCPSETUP.DLL" (szDir As String) As Integer DECLARE FUNCTION ExitWindows LIB "User" (dwReserved As Long, wReturnCode As Integer) As Integer DECLARE FUNCTION ShowWindow Lib "User" (hWnd As Integer, nCmdShow As Integer) As Integer INIT: IF ShowWindow(HWndFrame(), 3) THEN END IF CUIDLL$ = "mscuistf.dll" ''Custom user interface dll HELPPROC$ = "FHelpDlgProc" ''Help dialog procedure SetBitmap CUIDLL$, LOGO SetTitle "Dart Communications" SetAbout "GCP++ TCP/IP Development Tools" + Chr$(13) + "Version 2.3" + Chr$(13) + "for Microsoft Windows","Dart Communications" + Chr$(13) + "(315) 841-8106" + Chr$(13) + "INTERNET: baldwin@SUNYIT.edu" szInf$ = GetSymbolValue("STF_SRCINFPATH") IF szInf$ = "" THEN szInf$ = GetSymbolValue("STF_CWDDIR") + "SETUP.INF" END IF ReadInfFile szInf$ DEST$ = "C:\GCP" '$IFDEF DEBUG i% = SetSizeCheckMode(scmOnIgnore) '' could use scmOff; def = scmOnFatal WinDrive$ = MID$(GetWindowsDir, 1, 1) IF IsDriveValid(WinDrive$) = 0 THEN i% = DoMsgBox("Windows drive ('"+WinDrive$+"') is not a valid drive.", "DEBUG", MB_TASKMODAL+MB_ICONHAND+MB_OK) GOTO QUIT END IF '$ENDIF ''DEBUG WELCOME: sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$) IF sz$ = "CONTINUE" THEN UIPop 1 ELSE GOSUB ASKQUIT GOTO WELCOME END IF GETPATH: SetSymbolValue "EditTextIn", DEST$ SetSymbolValue "EditFocus", "END" GETPATHL1: sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$) DEST$ = GetSymbolValue("EditTextOut") IF sz$ = "CONTINUE" THEN IF IsDirWritable(DEST$) = 0 THEN GOSUB BADPATH GOTO GETPATHL1 END IF UIPop 1 ELSEIF sz$ = "REACTIVATE" THEN GOTO GETPATHL1 ELSEIF sz$ = "BACK" THEN UIPop 1 GOTO WELCOME ELSE GOSUB ASKQUIT GOTO GETPATH END IF Install QUIT: ON ERROR GOTO ERRQUIT IF ERR = 0 THEN dlg% = EXITSUCCESS ELSEIF ERR = STFQUIT THEN dlg% = EXITQUIT ELSE dlg% = EXITFAILURE END IF IF dlg% = EXITSUCCESS THEN ' Remainder commented out because setup files are left behind...very messy ' MSG% = DoMsgBox("You must re-boot your system for installation to take effect."+Chr$(13)+Chr$(10)+"Do you want to restart now?", "EXIT SETUP", 36) ' IF MSG% = 6 THEN 'RESTARTLINE: ' suc = ExitWindows(67, 0) ' if 1=RestartListEmpty then ' MSG% = DoMsgBox("Cannot Restart", "Restart List Empty", 36) ' else ' MSG% = DoMsgBox("Restarting", "Restart List OK", 36) ' SetRestartDir Dest$ ' end if ' Suc = ExitExecRestart() ' MSG% = DoMsgBox("Not all applications terminated.", "RESTART ERROR", 53) ' IF MSG% = 4 THEN ' GOTO RESTARTLINE ' END IF ' END IF ' END IF END IF QUITL1: sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "") IF sz$ = "REACTIVATE" THEN GOTO QUITL1 END IF UIPop 1 END ERRQUIT: i% = DoMsgBox("Setup sources were corrupted, call Dart Communications at 315.841.8106", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND) END BADPATH: sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "") IF sz$ = "REACTIVATE" THEN GOTO BADPATH END IF UIPop 1 RETURN ASKQUIT: sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "") IF sz$ = "EXIT" THEN UIPopAll ERROR STFQUIT ELSEIF sz$ = "REACTIVATE" THEN GOTO ASKQUIT ELSE UIPop 1 END IF RETURN '** '** Purpose: '** Builds the copy list and performs all installation operations. '** Arguments: '** none. '** Returns: '** none. '************************************************************************* SUB Install STATIC SrcDir$ = GetSymbolValue("STF_SRCDIR") CreateDir DEST$, cmoNone OpenLogFile MakePath(DEST$, "LOGFILE.OUT"), 0 WriteToLogFile "" WriteToLogFile " User chose as destination directory: '" + DEST$ + "'" WriteToLogFile "" WriteToLogFile "May have had to create the directory: " + DEST$ WriteToLogFile "" SysDir$=GetWindowsSysDir() CreateDir DEST$ + "\bin", cmoNone CreateDir DEST$ + "\doc", cmoNone CreateDir DEST$ + "\gcp", cmoNone CreateDir DEST$ + "\vb", cmoNone CreateDir DEST$ + "\vb_tcp", cmoNone CreateDir DEST$ + "\vb_udp", cmoNone CreateDir DEST$ + "\vb_tlnt", cmoNone CreateDir DEST$ + "\vb_tftp", cmoNone CreateDir DEST$ + "\vb_220", cmoNone CreateDir DEST$ + "\lib", cmoNone CreateDir DEST$ + "\include", cmoNone AddSectionFilesToCopyList "binsection", SrcDir$, DEST$ + "\bin" AddSectionFilesToCopyList "docsection", SrcDir$, DEST$ + "\doc" AddSectionFilesToCopyList "gcpsection", SrcDir$, DEST$ + "\gcp" AddSectionFilesToCopyList "tcpsection", SrcDir$, DEST$ + "\vb_tcp" AddSectionFilesToCopyList "tlntsection", SrcDir$, DEST$ + "\vb_tlnt" AddSectionFilesToCopyList "tftpsection", SrcDir$, DEST$ + "\vb_tftp" AddSectionFilesToCopyList "udpsection", SrcDir$, DEST$ + "\vb_udp" AddSectionFilesToCopyList "vt220section", SrcDir$, DEST$ + "\vt220" AddSectionFilesToCopyList "libsection", SrcDir$, DEST$ + "\lib" AddSectionFilesToCopyList "includesection", SrcDir$, DEST$ + "\include" CopyFilesInCopyList Grp$="GCP++ Evaluation Edition" CreateProgmanGroup Grp$, "", cmoNone ShowProgmanGroup Grp$, 1, cmoNone vb$=FindFileInTree("vb.exe","c:\") vb$=vb$ + " " CreateProgmanItem Grp$, "Evaluation Edition", MakePath(DEST$ + "\doc","gcp_eval.wri"), "", cmoOverwrite CreateProgmanItem Grp$, "SDK Desc", "winword "+DEST$ + "\doc\sdk.doc", "", cmoOverwrite CreateProgmanItem Grp$, "GCP Server", DEST$ +"\bin\gcp242.exe", "", cmoOverwrite CreateProgmanItem Grp$, "Read Me", MakePath(DEST$ + "\doc" , "readme.wri"),"",cmoOverwrite CreateProgmanItem Grp$, "GCP Client", MakePath(DEST$ +"\bin","gcp_clnt.exe"),"",cmoOverwrite CreateProgmanItem Grp$, "GCP Client Help", MakePath(DEST$ +"\doc","gcp_clnt.hlp"),"",cmoOverwrite CreateProgmanItem Grp$, "C Developer's Guide", MakePath(DEST$ +"\doc","gcp_c.hlp"),"",cmoOverwrite CreateProgmanItem Grp$, "VB Developer's Guide", MakePath(DEST$ +"\doc","gcp_vb.hlp"),"",cmoOverwrite CreateProgmanItem Grp$, "TCP Custom Control", DEST$+"\vb_tcp\tcp.exe", "", cmoOverwrite if vb$ <> " " then CreateProgmanItem Grp$, "TCP Sample Form", vb$ + DEST$ + "\vb_tcp\tcp.mak", "", cmoOverwrite end if CreateProgmanItem Grp$, "TELNET Custom Control", DEST$ + "\vb_tlnt\tlnt.exe", "", cmoOverwrite if vb$ <> " " then CreateProgmanItem Grp$, "TELNET Sample Form", vb$ + DEST$ + "\vb_tlnt\tlnt.mak", "", cmoOverwrite end if CreateProgmanItem Grp$, "UDP Custom Control", DEST$ + "\vb_udp\udp.exe", "", cmoOverwrite if vb$ <> " " then CreateProgmanItem Grp$, "UDP Sample Form", vb$ + DEST$ + "\vb_udp\udp.mak", "", cmoOverwrite end if CreateProgmanItem Grp$, "TFTP Custom Control", DEST$ + "\vb_tftp\tftp.exe", "", cmoOverwrite if vb$ <> " " then CreateProgmanItem Grp$, "TFTP Sample Form", vb$ + DEST$ + "\vb_tftp\tftp.mak", "", cmoOverwrite end if CreateProgmanItem Grp$, "VT-220 Custom Control", DEST$ + "\vt220\vt220.exe", "", cmoOverwrite if vb$ <> " " then CreateProgmanItem Grp$, "VT-220 Form", vb$ + DEST$ + "\vt220\vt220.mak", "", cmoOverwrite end if CreateProgmanItem Grp$, "Ordering Information", MakePath(DEST$+"\doc" ,"order.wri"),"",cmoOverwrite MSG% = DoMsgBox("Modify AUTOEXEC.BAT to include new path?", "AUTOEXEC.BAT", 36) ' OK and CANCEL IF MSG% = 6 THEN If EditAutoexec(DEST$) = 0 Then WriteToLogFile " Using GCPSETUP.DLL to edit AUTOEXEC.BAT: Successful" msg% = DoMsgBox ("AUTOEXEC.BAT renamed AUTOEXEC.GCP"+Chr$(13)+Chr$(10)+"AUTOEXEC.BAT PATH now includes "+DEST$+"\BIN"+Chr$(13)+Chr$(10)+"--- Reboot for changes to take effect ---","AUTOEXEC Modified",0) Else WriteToLogFile " Using GCPSETUP.DLL to edit AUTOEXEC.BAT: Failed" msg% = DoMsgBox ("Unable to modify AUTOEXEC.BAT"+Chr$(13)+Chr$(10)+"Add "+DEST$+"\BIN to PATH environment variable.","AUTOEXEC Not Modified",48) End If else i% = DoMsgBox("Ensure you include "+ DEST$ + "\bin in your PATH!", "AUTOEXEC not modified!", MB_OK) End If CloseLogFile END SUB '** '** Purpose: '** Appends a file name to the end of a directory path, '** inserting a backslash character as needed. '** Arguments: '** szDir$ - full directory path (with optional ending "\") '** szFile$ - filename to append to directory '** Returns: '** Resulting fully qualified path name. '************************************************************************* FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING IF szDir$ = "" THEN MakePath = szFile$ ELSEIF szFile$ = "" THEN MakePath = szDir$ ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN MakePath = szDir$ + szFile$ ELSE MakePath = szDir$ + "\" + szFile$ END IF END FUNCTION