Michael_I_Summers@cup.portal.com (05/15/91)
I'm trying to write a windowless DA (menu's only), and am having no luck. IM p. I-445 claims that it's ok not to have a window, but it looks like my open fails without it (I don't get my menu's). Any suggestions? Thanks, Mike
time@ice.com (Tim Endres) (05/16/91)
In article <42321@cup.portal.com> you write: > I'm trying to write a windowless DA (menu's only), and am having no luck. IM > p. I-445 claims that it's ok not to have a window, but it looks like my open > fails without it (I don't get my menu's). Any suggestions? My DA's work with no windows. I think it does nothing special. Note that the menu ID must match the DA's reference number. That globals structure is something I define and use. pascal short DRVROpen(pb, dCtl) CntrlParam *pb; DCtlPtr dCtl; { UGlobalPtr globals; GrafPtr saveport; /* * If the dCtlStorage is non-nil, we have already opened. * This desk accessory ignores multiple opens. */ if (dCtl->dCtlStorage != NULL) { return noErr; } GetPort(&saveport); dCtl->dCtlStorage = NewHandle((long)sizeof(UGlobals)); if (dCtl->dCtlStorage == NULL) { SysBeep(120); return noErr; } HLock(dCtl->dCtlStorage); globals = (UGlobalPtr) *dCtl->dCtlStorage; globals->thedce = dCtl; globals->ctlref = dCtl->dCtlRefNum; globals->resid = (0xC000 | ((~dCtl->dCtlRefNum) << 5)); dCtl->dCtlMenu = globals->resid; globals->themenu = NewMenu((short)globals->resid, "\pMenuTitle"); AppendMenu(globals->themenu, "item1;item2;item3;"); InsertMenu(globals->themenu, (short)0); DrawMenuBar(); SetPort(saveport); HUnlock(dCtl->dCtlStorage); return noErr; } ------------------------------------------------------------- Tim Endres | time@ice.com ICE Engineering | uupsi!ice.com!time 8840 Main Street | Voice FAX Whitmore Lake MI. 48189 | (313) 449 8288 (313) 449 9208