  { SETUP.INS - CD-ROM Installation File - Windows-platform          }

  InstName := 'C/C++ Users Journal CD-ROM';
  Cls;
  StrRet := InstName;
  DoFunc(0);

GetFrom:
  DoFunc(5);
  Mssg(6,3,'Enter the Drive letter of your CD-ROM drive.');
  DoFunc(11);
  DoFunc(2);
  CDROMDrive := StrRet;
  BranchEq(IntRet,0,Leaving);
  BranchEq(IntRet,2,GetFrom);

GetDrive:
  DoFunc(5);
  Mssg(6,3,'Enter the Drive letter of your hard disk.');
  StrRet := 'C';
  DoFunc(2);
  ToDrive := StrRet;
  BranchEq(IntRet,0,Leaving);
  BranchEq(IntRet,2,GetDrive);

GetPath:
  DoFunc(5);
  Mssg(6,3,'Enter the Path to Install the CD into.  The default');
  Mssg(6,4,'path is \CUJ');
  StrRet := '\CUJ';
  DoFunc(3);
  SysPath := '';
  Concat(SysPath,ToDrive,':',StrRet);
  ReadPath := SysPath

  DoFunc(5);
  Mssg(6,3,'You have specified the following:');
  a := '';
  Concat(a,'- CD-ROM is in Drive ',CDROMDrive,':');
  Mssg(6,5,a);
  a := '';
  Concat(a,'- Application will be installed into ',SysPath);
  Mssg(6,6,a);
  DoFunc(7);
  DoFunc(5);
  BranchEq(IntRet,0,Leaving);
  BranchEq(IntRet,2,GetFrom);
  BranchEq(IntRet,3,Leaving);

  {Check if they have (IntRet*2+100) Kilobytes available on their hard disk}
  IntRet := 1100;
  DoFunc(4);
  BranchEq(IntRet,0,Leaving);
  BranchEq(IntRet,2,Leaving);
  BranchEq(IntRet,3,Leaving);

  DoFunc(5);
  Mssg(6,3,'Installing CD-ROM start up batch file now:');

  {Make The Directories Here}
  Mssg(5,21,'Creating Directory...');
  ChDir(CDROMDrive,':');
  ChDir('\CUJ');       {built in directory name on the CD}
  ChDir(ToDrive,':');
  MkDir(SysPath);
  ChDir(SysPath);

  StrRet := SysPath;
  DoFunc(6);
  ConCat(StrRet,'HRW.INI');

  IntRet := 0;
  DoFunc(23);
  BranchEq(IntRet,0,DoCopy);
  Goto Error;

DoCopy:
  Mssg(5,21,'Modifying Initialization File...');
  Copy(CDROMDrive,':\CUJ\HRW.INI');

  IntRet := 0;
  DoFunc(23);
  BranchEq(IntRet,0,DoOpen);
  Goto Error;

DoOpen:
  DoFunc(18);
  BranchEq(IntRet,0,INIOpen);
  Goto Error;

INIOpen:
  StrRet := 'Document Path = ';
  Concat(StrRet,CDROMDrive,':\CUJ');
  DoFunc(19);
  BranchEq(IntRet,0,Wrote1);
  Goto Error;

Wrote1:
  StrRet := 'Alternate Picture Path = ';
  Concat(StrRet,SysPath);
  DoFunc(19);
  BranchEq(IntRet,0,Wrote2);
  Goto Error;

Wrote2:
  StrRet := 'Text Path=';
  Concat(StrRet,SysPath);
  DoFunc(19);
  BranchEq(IntRet,0,Wrote3);
  Goto Error;

Wrote3:
  StrRet := 'Use Directories=2';
  DoFunc(19);
  BranchEq(IntRet,0,WroteINI);
  Goto Error;

WroteINI:
  DoFunc(20);
  BranchEq(IntRet,0,INIClose);
  Goto Error;

INIClose:
  StrRet := SysPath;
  DoFunc(6);
  ConCat(StrRet,'HRW.INI');
  IntRet := 1;
  DoFunc(23);
  BranchEq(IntRet,0,INIROOK);
  Goto Error;

INIROOK:

  {Copy Files}
  Copy(CDROMDrive,':\CUJ\HRW.EXE');
  Copy(CDROMDrive,':\CUJ\CTL3D.DLL');
  Copy(CDROMDrive,':\CUJ\HRW.DIA');
  Copy(CDROMDrive,':\CUJ\HRW.CFG');
  Copy(CDROMDrive,':\CUJ\HWSYSTEM.VGA');
  Copy(CDROMDrive,':\CUJ\IMAGES.DLL');
  Copy(CDROMDrive,':\CUJ\IMGPCX.DIL');
  Copy(CDROMDrive,':\CUJ\STEM.KS');
  Copy(CDROMDrive,':\CUJ\THES.KS');
  Copy(CDROMDrive,':\CUJ\HRW.HW4');
  Copy(CDROMDrive,':\CUJ\HRW.HWN');
  Copy(CDROMDrive,':\CUJ\HRW.HWT');
  Copy(CDROMDrive,':\CUJ\HRW.HWA');
  Copy(CDROMDrive,':\CUJ\HRW.HWI');
  Copy(CDROMDrive,':\CUJ\HRW.HWY');
  Copy(CDROMDrive,':\CUJ\INDEX.HWY');

  Copy(CDROMDrive,':\CUJ\1990.PCX');
  Copy(CDROMDrive,':\CUJ\1991.PCX');
  Copy(CDROMDrive,':\CUJ\1992.PCX');
  Copy(CDROMDrive,':\CUJ\1993.PCX');
  Copy(CDROMDrive,':\CUJ\1994.PCX');
  Copy(CDROMDrive,':\CUJ\1995.PCX');
  
  Copy(CDROMDrive,':\CUJ\_STARTUP.PCX');
  Copy(CDROMDrive,':\CUJ\ALLYEARS.PCX');
  Copy(CDROMDrive,':\CUJ\CLOSERCH.PCX');
  Copy(CDROMDrive,':\CUJ\CONTENTS.PCX');
  Copy(CDROMDrive,':\CUJ\INDEXSEL.PCX');
  Copy(CDROMDrive,':\CUJ\MAIN.PCX');
  Copy(CDROMDrive,':\CUJ\METAYEAR.PCX');
  Copy(CDROMDrive,':\CUJ\_SEARCH.PCX');    
  Copy(CDROMDrive,':\CUJ\_RESULTS.PCX');    

  Copy(CDROMDrive,':\CUJ\1990.HWN');
  Copy(CDROMDrive,':\CUJ\1991.HWN');
  Copy(CDROMDrive,':\CUJ\1992.HWN');
  Copy(CDROMDrive,':\CUJ\1993.HWN');
  Copy(CDROMDrive,':\CUJ\1994.HWN');
  Copy(CDROMDrive,':\CUJ\1995.HWN');
  Copy(CDROMDrive,':\CUJ\CONTENTS.HWN');
  Copy(CDROMDrive,':\CUJ\INDEX.HWN');
  Copy(CDROMDrive,':\CUJ\INDEXART.HWN');
  Copy(CDROMDrive,':\CUJ\INDEXFUL.HWN');
  Copy(CDROMDrive,':\CUJ\INDEXAUT.HWN');
  Copy(CDROMDrive,':\CUJ\INDEXLIS.HWN');
  Copy(CDROMDrive,':\CUJ\CUJ.ICO');

  Copy(CDROMDrive,':\README.TXT');

{  Copy(CDROMDrive,':\CUJ\_CONTENT.PCX'); }
{  Copy(CDROMDrive,':\CUJ\_EXIT.PCX');    }
{  Copy(CDROMDrive,':\CUJ\_EXPORT.PCX');  }
{  Copy(CDROMDrive,':\CUJ\_FIND.PCX');    }
{  Copy(CDROMDrive,':\CUJ\_HELP.PCX');    }
{  Copy(CDROMDrive,':\CUJ\_HIGHLIG.PCX'); }
{  Copy(CDROMDrive,':\CUJ\_HITS.PCX');    }
{  Copy(CDROMDrive,':\CUJ\_INDEX.PCX');   }
{  Copy(CDROMDrive,':\CUJ\_NEXT.PCX');    }
{  Copy(CDROMDrive,':\CUJ\_NOICON.PCX');  }
{  Copy(CDROMDrive,':\CUJ\_NOTES.PCX');   }
{  Copy(CDROMDrive,':\CUJ\_NSEARCH.PCX'); }
{  Copy(CDROMDrive,':\CUJ\_OUTLINE.PCX'); }
{  Copy(CDROMDrive,':\CUJ\_PREV.PCX');    }
{  Copy(CDROMDrive,':\CUJ\_PRINT.PCX');   }
{  Copy(CDROMDrive,':\CUJ\_PSEARCH.PCX'); }

  Mssg(5,21,'Creating Program Manager Group...');
  StrRet := 'C/C++ Users Journal CD-ROM';
  DoFunc(16);
  BranchEq(IntRet,0,Complete);

  StrRet := SysPath;
  DoFunc(6);
  SysPath2 := StrRet;
  Concat(StrRet,'HRW.EXE');
  Concat(StrRet,',','CUJ CD-ROM');
  Concat(StrRet,',',SysPath2,'CUJ.ICO');
  DoFunc(17);
  Mssg(5,21,'For important information, please see README.TXT File...');

{ Routines to Add Read Me File }
  StrRet := '';
  Concat(StrRet,'NOTEPAD.EXE');
  Concat(ReadFile,' ',SysPath2,'README.TXT');
  Concat(StrRet,ReadFile);
  Concat(StrRet,',','READ ME FILE');
  DoFunc(17);

{ End Routines for Read Me File} 

Complete:
  StrRet := InstName;
  DoFunc(0);
  Mssg(0,0,'Installation Complete');
  Cls;
  Goto Exit;

Error:
  StrRet := InstName;
  DoFunc(0);
  Mssg(0,0,'An error has occurred during the installation process.');
  Cls;
  Goto Exit;

Leaving:
  StrRet := InstName;
  DoFunc(0);
  Mssg(0,0,'Installation aborted by User');
  Cls;
  Goto Exit;

Exit:
