CloseDeskAcc
short daRefNum ; reference number of DA to close
and the frontmost window is that of a DA. The DA window is removed from the
screen and the next-to-frontmost window is reactivated.
daRefNum identifies the DA to close. The value to use is stored in the
windowKind field of the DA's window (see the example, below).
Notes: There is no need to use this call when the user closes a DA by clicking its
Close box; in that case the Desk Manager takes care of it. Use
CloseDeskAcc only when a system window is frontmost and the user picks Close from your File menu.
It is incorrect to use the daRefNum returned from a previous call to
OpenDeskAcc. The DA reference number is stored in the DA's WindowRecord. It is a negative number in the windowKind field. This has ramifications for DAs (see IsDialogEvent). For non-DA applications, a typical sequence might include:
WindowPeek wPeek;
long mr;
if ( theEvent.what == mouseDown ) {
case inMenuBar:
if ( HiWord( mr ) == FILE_MENU ) { /* in File menu? */ if ( LoWord( mr ) == CLOSE_ITM ) {/* Close Item ? */ /* if it's mine */
/* ... close one of my application's windows ..*/
}
else { /* must be a DA window */
}
}
}
case inContent:
/* .. etc ... */
}
}
}