Re: Eject Key Code
Re: Eject Key Code
- Subject: Re: Eject Key Code
- From: Pascal Pochet <email@hidden>
- Date: Tue, 27 Jun 2006 15:00:32 +0200
Le 26-juin-06 à 21:20, Damien Bobillot a écrit :
Casey Fleser wrote :
Check this post:
http://www.cocoabuilder.com/archive/message/cocoa/2004/10/5/118853
The relevant bits of which are:
[really interesting code]
And the tiebreaker question is ;) :
Is there a more direct way to open the CD tray, by using the IOKit
by instance ? It's a bit tricky to simulate a keystroke just to
open the CD tray. If I recall well, the command line tool hdiutil
may be used to open it.
--
Damien Bobillot
Solution is in DiscRecording framework
#import <DiscRecording/DRDevice.h>
...
NSArray *devices = [DRDevice devices] ;
NSEnumerator *aEnum = [devices objectEnumerator];
DRDevice *aDevice ;
while ((aDevice = [aEnum nextObject]) != nil) {
if ([[[aDevice info]
objectForKey:DRDeviceLoadingMechanismCanOpenKey] boolValue]) {
// there are also
DRDeviceLoadingMechanismCanInjectKey and
DRDeviceLoadingMechanismCanEjectKey
// the device supports openTray and closeTray
[aDevice openTray] ;
...
[aDevice closeTray] ;
}
}
Pascal Pochet
email@hidden
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden