realbasic-nug
[Top] [All Lists]

How can I determine if my program CD is in the drive of a Win32 machine?

To: REALbasic Network Users Group <realbasic-nug at lists dot realsoftware dot com>
Subject: How can I determine if my program CD is in the drive of a Win32 machine?
From: Karl Holmes <karlh at nh dot com dot au>
Date: Fri, 28 Jun 2002 22:18:55 +1000
Hi people, I need some help again.

The program I am writing uses a large number of small sound files. I
want to give the user the option of loading all these onto their hard
drive or to access them from the program CD.
To do this I need to determine if the program CD is in the drive.
On a Mac this is easy. I just use the code

    n=volumeCount-1
    for i = 0 to n
      volName=volume(i).name
      if left(volName,17)="Aussie SpellForce" then
        flag = true
        index = i
      end if
    next

However on a Win32 machine
volume(i).name

just yields  D: etc and I can't tell if it is my program CD or another
one in the drive.


I tried

  n=volumeCount-1
  for i = 0 to n
    s= volume(i).name
    f=getfolderitem(volume(i).name).child("SFDev409") //SFDev409 is a
file on top level of CDROM
    if not(f =nil) then
      if f.exists then
        statictext1.text = "CDROM found"
      end if
    end if
  next

but couldn't get this to work even on a Mac, f was always nil.

Any ideas or suggestions please?


Regards


Karl Holmes



<Prev in Thread] Current Thread [Next in Thread>