mxmora@unix.SRI.COM (Matt Mora) (10/24/90)
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? 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? 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? 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? Thanks for any insight you can provide. P.S. IM talks about get the drive's icon by doing a PBcontrol call. I tried that but THINK Pascal won't let me coerse the return value in to a handle. Boy, I really should learn C :-) -- ___________________________________________________________ Matthew Mora | my Mac Matt_Mora@sri.com SRI International | my unix mxmora@unix.sri.com ___________________________________________________________
stevec@Apple.COM (Steve Christensen) (10/25/90)
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