Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!uwm.edu!linac!mp.cs.niu.edu!ux1.cso.uiuc.edu!uxh.cso.uiuc.edu!johnsone From: johnsone@uxh.cso.uiuc.edu (Erik A. Johnson) Newsgroups: comp.sys.mac.programmer Subject: Re: Check DialogPtr returned by GetNewDialog? Message-ID: <1991Apr3.060845.18062@ux1.cso.uiuc.edu> Date: 3 Apr 91 06:08:45 GMT References: <1991Apr1.052536.27902@ux1.cso.uiuc.edu> <4143@uakari.primate.wisc.edu> <1991Apr1.224254.5399@neon.Stanford.EDU> <1991Apr2.142214.980@ux1.cso.uiuc.edu> Sender: usenet@ux1.cso.uiuc.edu (News) Organization: University of Illinois at Urbana Lines: 33 dorner@pequod.cso.uiuc.edu (Steve Dorner) writes: >>-> Do any of you check to see if the DialogPtr that GetNewDialog returns is >>-> valid in any way? >>>You want to read Technical Note 4 and then hold your breath in awe >>>at the advice it gives: >>> Assume there is no error >>So what do you want do if there IS an error... put up an ALERT dialog? > >There are any number of reasonable things you could do, if you knew that >GetNewDialog had failed: > >1. Skip the alert, and hope for the best. >2. Pitch some clean windows, and then try an alert. >3. Put up a 'vital resource not found' alert (which might work). >4. Quietly ExitToShell. > >Any of these alternatives smell better than trying to put up an a nonexistent >dialog. This is exactly what I was trying to get at in my original question about checking the validity of a GetNewDialog DialogPtr. In a program I'm writing, I was going to check for an error and then SysBeep() at the user a time or two and then simply ExitToShell(), rather than forge on ahead and (probably) cause the whole system to crash. By the way, thanks for pointing out TechNote 4. (Duh, look, Erik! :-) But the question still stands. How can I test for GetNewDialog's validity? Erik A. Johnson, Graduate Student \ Internet: johnsone@uxh.cso.uiuc.edu Aeronautical & Astronautical Engineering \ University of Illinois at Urbana-Champaign \ AmericaOnline: ErikAJ