Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!apple!oliveb!amiga!jimm From: jimm@amiga.UUCP (Jim Mackraz) Newsgroups: comp.sys.amiga.tech Subject: Re: Anybody know how to do this stuff? Message-ID: <4954@amiga.UUCP> Date: 30 Nov 89 22:25:11 GMT References: <13920020@hpfelg.HP.COM> Reply-To: jimm@batgirl.UUCP (Jim Mackraz) Organization: Commodore-Amiga Inc, Los Gatos CA Lines: 46 In article <13920020@hpfelg.HP.COM> koren@hpfelg.HP.COM (Steve Koren) writes: )2) There's a command called something like "SetWindowTitles()" (I'm ) doing this from memory so that may not be the exact name). I can ) set the window title to anything I choose; I've found from experimentation ) that I need to AllocMem() the memory for the title so that it doesn't ) go away when my program terminates (since apparently SetWindowTitles() ) doesn't copy the string you give it, it just uses it directly). Well, ) that much is no problem. But I'd like to get rid of the space used by ) the *old* title. I am afraid to just FreeMem() it, though, since my ) program hasn't a clue where it came from. It *could* have been created ) by an AllocMem() call, or it could be a static string in some program. ) In the latter case, it would be quite rude to FreeMem() the string. ) How do I get rid of it if I don't know where it came from? (I can't ) just save it and put it back later since I am creating a stand-alone ) binary which changes the title). Also, if I assume it was AllocMem()ed, ) I don't know how big the buffer was. For example, it could have been ) 100 allocated bytes with a 20 byte string copied into it. Since ) FreeMem() needs to know the byte size, I wouldn't be freeing all the ) memory. In normal circumstances, this is no problem. If you close your window when you exit, Intuition will not need to fetch that window's screen title again, I believe. It leaves it rendered on the screen bar, and hangs onto the pointer, but that pointer gets reset when any window becomes active in the same screen. I'm pretty sure that the title won't get rerendered using the bogus pointer. Do you have a counterexample? It sounds a lot like you are setting titles for windows you do not own and then exiting, or otherwise treading dangerously on thin ice. You should try not to leave little "title turds" hanging around in memory, nor should you guess whether to free memory you encounter. Write a library, have it track your memory turds, and when you call its SetAllocedWindowTitles(), it will toss the old title if it recognizes as something from its list. You could also hang a bookkeeping list off of a named port that your weird little program can find. jimm -- -------------------------------------------------- - opinions by me "This voice console is a *must*. I press Execute. `Hello, I know that you've been feeling tired. I bring you love and deeper understanding.' " -lyrics by Kate Bush