how to get printer added notification/event?
how to get printer added notification/event?
- Subject: how to get printer added notification/event?
- From: Gonzalo Castro <email@hidden>
- Date: Fri, 4 Jun 2004 11:47:15 -0400
Hello,
I'm using the array returned by [NSPrinter printerNames] to populate a
popup in my UI that contains the list of available printers. I'd like
this popup to update as a user plugs in or unplugs a USB printer.
I watched all notifications in my object using;
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(receiveAllNotifications:) name:nil object:nil];
but saw no notification when a printer was either plugged in or added
to the list of available printers in Printer Setup Utility.
I also tried watching for USB notifications. Using much of the code
from Apple's sample app, USBPrivateDataSample, I can detect when a USB
printer is connected and disconnected, however, the printer isn't
actually available (according to [NSPrinter printerNames] and the
Printer Setup Utility) for a few seconds after it's connected.
If I delay my call to [NSPrinter printerNames] after the IO
notification, then I see the new printer in the array returned.
Is there a better way to do this? Thanks.
Gonzalo
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.