• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
how to get printer added notification/event?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


  • Follow-Ups:
    • Objective-C Question
      • From: colin schaub <email@hidden>
  • Prev by Date: Changing Application/Disc Icons?
  • Next by Date: NSTextField and first responder - when does a feature become a bug?
  • Previous by thread: Changing Application/Disc Icons?
  • Next by thread: Objective-C Question
  • Index(es):
    • Date
    • Thread