Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!microsoft!t-alexc From: t-alexc@microsoft.UUCP (Alex CHAFFEE) Newsgroups: comp.sys.mac.programmer Subject: Re: cdev - INIT Data Exchange Keywords: cdev, INIT Message-ID: <55045@microsoft.UUCP> Date: 5 Jun 90 07:01:37 GMT References: <2695@cooper.cooper.EDU> Reply-To: t-alexc@microsoft.UUCP (Alex CHAFFEE) Organization: Microsoft Corp., Redmond WA Lines: 34 In article <2695@cooper.cooper.EDU> joseph@cooper.cooper.EDU (Joe Giannuzzi) writes: > > I am writing a cdev that contains an INIT. I would like to > exchange data between the two, but so far my attempts have > failed. Does anyone have any recommendations about the best > way to do this? Also, I have one DITL item that is an ICON. > What is the best way for me to change the icon that it > displays? Thanks. > > Joseph -> joseph@cooper.cooper.edu OR cmcl2!cooper!joseph My favorite way is to have the INIT write a resource of type 'ADDR' into the preferences file (which should be buried safe in the system folder). The contents of this resource is just a longword pointing to the location of the shared data -- it can be a handle, or a pointer, or the proper value of A4. This is done once at startup, which is fine because the INIT code and data should be locked in memory for the duration.. This sounds kludgey, but it's actually quite clean and compatible. The INIT is guaranteed a writable system folder, even if it's been launched from a server. The existence and validity of the resource provides a quick way for the cdev to tell if the INIT's been loaded. The preferences file is going to keep the same name, even if the user renames the actual cdev/INIT file, so it'll be easy to find. Plus you don't have to walk through the system heap map, or install a driver, or any of the 1001 nasty alternative methods I've heard of... As for your ICON, can't you just set the itemHandle to the new ICON resource (after GetResourceing it in from disk)? I thought that was how the Dialog Manager dealt with ICONs, but I'm not sure. - Alex Chaffee chaffee@reed.bitnet or t-alexc@microsoft.uucp