Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
LOCAL lnDriveMap, lnDrive, lcDrive
DECLARE INTEGER GetLogicalDrives IN kernel32
lnDriveMap = GetLogicalDrives()
FOR lnDrive = 0 TO 25
lcDrive = Chr(lnDrive + 65)
IF DriveType(lcDrive) = 5
*--This is a CD. Do whatever.
EXIT
ENDIF
ENDFOR
Declare Integer GetLogicalDrives In Win32API
Declare Integer GetDriveType In Win32API String RootPath
Declare GetVolumeInformation In win32api String, String @, Integer, Integer @, Integer @, Integer @, String @, Integer
#Define DRIVE_REMOTE 4
#Define DRIVE_CDROM 5
m.drivelist = GetLogicalDrives()
For i = 0 To 31
If Bittest(m.drivelist, i)
m.DriveRoot = Chr(65 + i) + ":\"
* perform a GetDriveType to determine if it's a floppy, CD, etc.
m.drivetype = GetDriveType(m.DriveRoot)
Do Case
*!* CASE m.drivetype = DRIVE_REMOTE
*!* m.drivestring = "Remote/Network drive"
Case m.drivetype = DRIVE_CDROM
m.drivestring = "CD-ROM drive"
Endcase
* perform a GetVolumeInformation
m.RootPath = m.DriveRoot
m.volname = Space(255)
m.volnamelen = Len(m.volname)
m.volumeserialnumber = 0
m.maxfilenamelen = 0
m.filesystemflags = 0
m.filesystemname = Space(255)
m.fsnamelen = Len(m.filesystemname)
=GetVolumeInformation(m.RootPath, @m.volname, m.volnamelen, @m.volumeserialnumber, @m.maxfilenamelen, ;
@m.filesystemflags, @m.filesystemname, m.fsnamelen)
m.volname = Left(m.volname, At(Chr(0), m.volname) - 1)
Endif
Endfor
? m.DriveRoot+" "+ m.drivestring+" "+m.volname
You are calling GetLogicalDrives(), which I understand returns a bitmap of the logical drives, but you are not using the value that it returns.
Declare Integer GetLogicalDrives In Win32API
Declare Integer GetDriveType In Win32API String RootPath
Declare GetVolumeInformation In win32api String, String @, Integer, Integer @, Integer @, Integer @, String @, Integer
#Define DRIVE_REMOTE 4
#Define DRIVE_CDROM 5
drivelist = GetLogicalDrives()
For i = 0 To 31
If Bittest(drivelist, i)
DriveRoot = Chr(65 + i) + ":\"
* perform a GetDriveType to determine if it's a floppy, CD, etc.
drivetype = GetDriveType(DriveRoot)
Do Case
Case drivetype = DRIVE_REMOTE
drivestring = "Remote/Network drive"
Case drivetype = DRIVE_CDROM
drivestring = "CD-ROM drive"
Exit
Endcase
Endif
Endfor
If drivetype = DRIVE_CDROM
* perform a GetVolumeInformation
RootPath = DriveRoot
volname = Space(255)
volnamelen = Len(volname)
volumeserialnumber = 0
maxfilenamelen = 0
filesystemflags = 0
filesystemname = Space(255)
fsnamelen = Len(filesystemname)
=GetVolumeInformation(RootPath, @volname, volnamelen, @volumeserialnumber, @maxfilenamelen, ;
@filesystemflags, @filesystemname, fsnamelen)
volname = Left(volname, At(Chr(0), volname) - 1)
*? DriveRoot+" "+ drivestring+" "+volname
***** [b]Change "its.prg" with your file[/b]
cFilename = Addbs(DriveRoot)+"its.prg"
**** lets check if there is writable cd in drive
If !Empty(volname)
Copy File its.prg To (cFilename)
If File(cFilename)
=Messagebox("File copied",64,"CD Drive")
Else
=Messagebox("could not write to CD",64,"CD Drive")
Endif
Else
=Messagebox("Insert a CD in "+DriveRoot+" "+ drivestring,64,"CD Drive")
Endif
Else
Wait "no cd rom drive found" Window Nowait
Endif