Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!ucsd!hub!castor!stoms From: stoms@castor.ncgia.ucsb.edu (David Stoms) Newsgroups: comp.sys.mac.programmer Subject: Re: control definition functions without CDEFs? Message-ID: <4299@hub.UUCP> Date: 13 Mar 90 16:43:44 GMT References: <423@fornax.UUCP> <8013@tank.uchicago.edu> <10098@portia.Stanford.EDU> Sender: news@hub.UUCP Reply-To: stoms@castor.ncgia.ucsb.edu (Josh Pritikin) Distribution: na Organization: U. C. Santa Barbara, Geography Department Lines: 22 In article <10098@portia.Stanford.EDU> duggie@jessica.Stanford.EDU (Doug Felt) writes: >In article <8013@tank.uchicago.edu> asl2@tank.uchicago.edu (Aaron "Fish" Lav) writes: >>In article <423@fornax.UUCP> mcdonald@fornax.UUCP (Ken Mcdonald) writes: >>>I'm writing up a bit of source which, eventually, I'd like to distribute. It >>>uses custom CDEFs, but one thing I'd like to do is to avoid making users >>>of the source copy extra CDEFs into their applications--that is, I'd like >>>to build the custom controls entirely within the source. The first >>What you want to do is allocate a six-byte handle, and fill that with a jump >>to your procedure's address. There was a Mactutor example of how to do this >Make sure, by the way, that the procedure is in a segment that will stay >locked while the control is in use. One more hint-- you should create the control by specifying a real CDEF resource. To accomplish this, you can use ResEdit or something to create a six byte CDEF handle on disk. Then do a GetResource and put in your JMP and address. I don't think your code needs to be in a locked segment, at least in ThinkC because when you take the address of a routine I think you get a pointer to a branch to that routine. At least I think it works like that in ThinkC. Try it, if I'm wrong correct me but I seem to remember doing it before. Josh Pritikin