Path: utzoo!attcan!uunet!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!lll-winken!sun-barr!olivea!apple!stevec From: stevec@Apple.COM (Steve Christensen) Newsgroups: comp.sys.mac.programmer Subject: Re: Volume Questions Keywords: Drive,Volumes,Devices Message-ID: <10899@goofy.Apple.COM> Date: 24 Oct 90 19:13:26 GMT References: <17533@unix.SRI.COM> Organization: Apple Computer Inc., Cupertino, CA Lines: 51 In article <17533@unix.SRI.COM> mxmora@sri-unix.sri.com (Matt Mora) writes: > >I have a few questions about getting information from mounted volumes. > >1. How do you tell if the media is removable? I know this has > been hashed over before but I could only find some C code from > Brian Bechel (sp?). Does anybody have code to do this in Pascal? Call PBHGetVInfo() to get information about the volume. Using the values in the ioVDrvInfo (drive number) and ioVDRefNum (driver refNum) fields of the parameter block, scan the drive queue until you find that drive's entry. Then look at the byte 3 bytes before that drive queue entry. If it's $08 or $48, the disk is not ejectable. Yes, I know this is ugly, but that's the way it goes. >2. This is related to question 1, what is the difference between > PBUnmountVol(pb) and PBEject(pb)? Can I just call PBUnmountVol and > will it eject a floppy? What about the reverse, am I wrong to assume that > eject will also unmount a volume? PBUnmountVol flushes the volume, closes open files, and releases memory used by the volume. PBEject flushes the volume and ejects the disk. As I recall, you typically need to do both. >3. I can't seem to find some sample code that shows how to get the icon from > a volume. Does anybody have some code to share? Make a control call with csCode=21 (for the drive's icon) or 22 (for the disk's icon). csParam will contain a pointer to the icon, icon mask, and a Pascal string describing where the drive is (for the drive icon). >What I'm doing: >I have a dialog box that the user can select a volume. It has four buttons >named, Select,Cancel,Eject,Drive. It also displays the name of the current >volume in a static text field. I would also like to display the current >volume's icon. > >Should the button named "eject" change its name when the next volume selected >is not ejectable to unmout or should it just be dimmed? Dim the eject button. steve -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ whoami? Steve Christensen snail: Apple Computer, 20525 Mariani Ave, MS-81CS, Cupertino, CA 95014 Internet: stevec@goofy.apple.com AppleLink: stevec CompuServe: 76174,1712