Important: The information in this document is obsolete and should not be used for new development.
Opening and Closing Device Drivers
A device driver must be open before your application can communicate with it. You can use theOpenDriverorPBOpenfunction to open closed drivers or to determine the driver reference number of a driver that is already open. You use theOpenSlotfunction to open drivers that serve slot devices. To open a desk accessory or other Apple menu item from within your application, use theOpenDeskAccfunction.When you finish communicating with a device driver, you can close it if you are sure no other application or part of the system needs to use it. You can use the
CloseDriverorPBClosefunction to close a driver. You use theCloseDeskAccfunction to close a desk accessory.The
PBOpenandPBClosefunctions use theIOParamunion of the Device Manager parameter block. TheOpenSlotfunction uses theIOParamunion fields and some additional fields that apply only to slot devices.
- IMPORTANT
- Device drivers cannot be opened or closed asynchronously. The
PBOpen,PBClose, andOpenSlotfunctions include an asynchronous option because they share code with the File Manager. Theasyncparameter must be set tofalsewhen these functions are used to open or close a device driver.![]()
Subtopics
- OpenDriver
- PBOpen
- OpenSlot
- OpenDeskAcc
- CloseDriver
- PBClose
- CloseDeskAcc