Installation program for shareware authors.
Submitted By:
WEBMASTER
Rating:
Not rated (
Rate It)
SUB FileCopy (Source$, Dest$)
SCREEN.MousePointer = 11 'hourglass
OPEN Source$ FOR BINARY AS #1
whole = LOF(1) 32000 'numer of whole 32768 byte chunks
part = LOF(1) MOD 32000 'remaining bytes at end of file
buffer$ = STRING$(32000, 0)
start& = 1
OPEN Dest$ FOR BINARY AS #2
FOR x = 1 TO whole 'this for-next loop will copy 32,000
GET #1, start&, buffer$ 'byte chunks at a time. If there is
PUT #2, start&, buffer$ 'less than 32,000 bytes in the file,
start& = start& + 32000 'whole = 0 and the loop is bypassed.
NEXT x
buffer$ = STRING$(part, 0) 'this part of the routine will copy
GET #1, start&, buffer$ 'the remaining bytes at the end of the
PUT #2, start&, buffer$ 'file.
CLOSE
END SUB
SUB IniCopy (lpApplication AS STRING, lpKeyName AS STRING, lpDefault AS STRING, SubDir AS STRING)
'start loop
I = 0
DO
SCREEN.MousePointer = 11 'hourglass
State% = DoEvents() 'allows list files to copied to be updated
I = I + 1
lpKeyName$ = "file" + STR$(I)
GetStringvar% = GetPrivateProfileString(lpApplication$, lpKeyName$, lpDefault$, FileStr$, nSize%, lpFileName$)
'check named mark to end loop
IF LEFT$(FileStr$, 7) = "EndMark" THEN
EXIT DO
ELSEIF LEFT$(FileStr$, 8) = "EndMark" THEN
EXIT DO
END IF
'copy all program files to destination dir
File$ = RTRIM$(FileStr$) 'move spaces from right
Dest$ = SubDir$ + "\" + File$
Source$ = SD$ + File$
IsFile$ = Dir$(Dest$) 'check if file already exist
IF IsFile$ = "" THEN
Install.Lbl_List.Caption = "Now copying file " + FileStr$
FileCopy Source$, Dest$
Install.List1.AddItem Dest$
ELSE
SCREEN.MousePointer = 0
IF WarnFlag = True THEN 'check overwrite flag
Warn.Lbl_Warn.Caption = "File already exist!, would you like to overwrite it? " + Dest$ 'give the user a change to prevent overwriting
Warn.Show 1
ELSE
Install.Lbl_List.Caption = "Now copying file " + FileStr$
Install.List1.AddItem Dest$
END IF
END IF
LOOP
SCREEN.MousePointer = 0 'default
END SUB