how to disable alert panel

yogish

Registered
when i try call open api on unmounted device.
i get "disk insertion" alert panel.

i want to disable this alert panel.
 
Which API are you using? It might be that the API won't work unless a disk is inserted. But that may not be the case. More information would definitely help.
 
Well, I assume you're using Cocoa, in which there is nothing wrong with that.

Personally, I have no idea what you're doing, but I would just set up a NSTimer that checks every now and then to see if a disk was inserted. I.e.:

if (no disk)
{
[thisObject doNothing];
}
else //disk inserted
{
[thisObject performAction];
}

As far as I know there's nothing you can do to disable the Alert Panel that shows up if there is no disc inserted. This might be where one of the frameworks might help.

Also if you have access to the NSAlert window you can try the NSAlert method -(NSWindow*)window method which returns the NSWindow or NSPanel. From here you can set the window to close, be completely transparent, pretty much anything you want. I would aim for the NSAlert window if possible.

There are also a lot of APIs available that deal with certain system attributes, which might be more helpful, you can view them under /System/Library/Frameworks/

Not all of these frameworks have the best documentation nor can you guarantee the object you're messaging will work. But if you look hard enough, it might be there. Hope that helps.

Edit: ElDiabloConCaca gave a good answer in a previous thread in checking for mountable media through NSWorkspace, but if the media is not even in one of the computer's drives, it's going to be hard to check for a disk that isn't even there. Might want to check one of the existing frameworks.
 
Last edited:
Back
Top