Re: FSGetVolumeInfo problem
- Subject: Re: FSGetVolumeInfo problem
- From: Laurence Harris <email@hidden>
- Date: Thu, 01 Dec 2005 00:39:06 -0500
- Delivered-to: email@hidden
- Delivered-to: email@hidden
- User-agent: Microsoft-Outlook-Express-Macintosh-Edition/5.0.4
On 12/1/05 12:13 AM, Ben Zhu didst favor us with:
>
> Larry,
>
> Please forget my previous email that was mistakenly sent.
>
>
> By Running the following code, the MonitorHandler still cannot be called
> when a USB flash mem stick is plugged in or pulled out.
>
> Any suggestion?
Any reason you aren't installing these on the application event target?
Larry
>
> Thanks,
> Ben
>
> EventHandferRef myHandler;
>
> installEventHandler(void)
> {
> EventTypeSpec kEvent[] =
> {
> {kEventClassVolume, kEventVolumeMounted},
> {kEventClassVolume, kEventVolumeUnmounted}
> };
>
>
> InstallEvenHandler(GetEventMonitorTarget(),MonitorHandler,
> GetEventTypeCount(kEvents)), kEvents,
> 0, &myHandler);
>
> RunApplicationEventLoop();
>
> }
>
>
> static OSStatus
> MonitorHandler( EventHandlerCallRef inCaller,
> EventRef inEvent, void* inRefcon ) { FSVolumeRefNum volRefNum;
>
> // get the event class
> switch ( GetEventClass( inEvent ) )
> {
> case kEventClassVolume:
>
> switch ( GetEventKind( inEvent ) )
> {
> case kEventVolumeMounted:
> case kEventVolumeUnmounted:
>
> GetEventParameter(
> inEvent,
> typeFSVolumeRefNum,
> kEventParamDirectObject
> NULL,
> sizeof(FSVolumeRefNum),
> NULL,
> &volRefNum);
>
> break;
>
> default:
> break;
> }
> break;
>
> default:
> break;
> }
> return noErr;
>
> }
>
>
>
>
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden
This email sent to email@hidden
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.