HDTenEightyP/NetNews huggingface dataset:
From: d88-jwa@byse.nada.kth.se (Jon Wtte)
Newsgroups: comp.sys.mac.programmer
Subject: Re: How *should* gestalt manager be used under sys 7?
Date: 11 Oct 92 21:36:44 GMT
Organization: Royal Institute of Technology, Stockholm, Sweden
Originator: d88-jwa@byse.nada.kth.se

> cmr45797@uxa.cso.uiuc.edu (Charles Mark Remes) writes:

   I am writing a system 7 only application, and I'm running into a wee
   bit of trouble interpreting the Gestalt manager.  Since this app

Well, re-precompile macheaders with #define SystemSixOrLater 1
and #define SystemSevenOrLater 1 (same goes for any MPW headers
if you use MPW)

   requires System 7, I'm using the gestalt manager to return the version
   number and making sure it is at least $0700.  Now I'm using an Informational

Bad idea.

Seems to be a lot of them these days (sorry :-)

The right thing to do is check what your program requires:
AppleEvents, FSpCalls, and tracked temporary memory seems to
be the most popular, together with FindFolder and Aliases.
So just have a function that looks like this:

//	Check the system for required features.
//	Return 0 and set *ptr to point to a string describing
//	what's missing on failure
//
static Boolean
SystemSpiffyEnough ( unsigned char * * ptr )
{
	long resp ;
	//	Allocate memory for string
	* ptr = ( Ptr ) NewPtr ( 256 ) ;

	//	First check for Gestalt
	if ( ! TrapAvailable ( _Gestalt ) ) {

		//	Fill in string of what's missing
		GetIndString ( * ptr , kSpiffinessStrings , kSpiffGestalt ) ;
		return 0 ;
	}
	//	AppleEvents?
	if ( Gestalt ( gestaltAppleEventsAttr , & resp ) ||
		! ( resp & ( 1 << gestaltAppleEventsPresent ) ) ) {

		//	Fill in string of what's missing
		GetIndString ( * ptr , kSpiffinessStrings , kSpiffAE ) ;
		return 0 ;
	}
	if ( ... )
		...

	//	OK, nothing's missing; dispose memory
	DisposePtr ( ( Ptr ) * ptr ) ;
	return 1 ;
}


and call the function like:

void
main ( void )
{
	unsigned char * ptr = NULL ;

	InitMac ( ) ; // InitGraf etc
	if ( ! SystemSpiffyEnough ( & ptr ) ) {

		//	We have a string describing what's missing
		ParamText ( ptr , NULL , NULL , NULL ) ;
		Alert ( kAlertSystemNotBadEnough , AlertButtonFunc ) ;
		ExitToShell ( ) ;
	}
	InstallAEHandlers ( ) ;
	...
}

As you see, each thing you want to check is only one or two lines;
the extra work os not much, and worth it. There "might" be plans
for System 6.X to have AppleEvents or FSSpec calls (I don't know,
but QuickTime implements a lot of them without setting the Gestalt
selector :-( )

Or PowerOpen 4.0 might return $400 in the version selector. Or
there might be a version > $7fff (not bl**dy likely :-)

Who knows? Just follow the rules! (I should charge for these
posts I do. Or publish them. "h+ on Mac Programming"?
"Hack the Mac - the Swedish Way"? What do you think? :-)

-- 
 -- Jon W{tte, h+@nada.kth.se, Mac Hacker Suedoise (not french speaking) --

   This article printed on 100% recycled electrons.
Newsgroups: comp.sys.mac.programmer
From: dmorgan@javelin.sim.es.com (Dave Morgan)
Subject: Getting mouse-moved events..
Keywords: Mouse-moved events.
Organization: Evans & Sutherland Computer Corporation
Date: Sat, 17 Oct 1992 00:08:18 GMT

     I am a bit confused on how I get mouse-moved events.  Should it be as
simple as:

  <Set up some region> (i.e. SetRectRgn)
  WaitNextEvent(everyEvent, &myevent, <some number>, &myregion); ??

     In my "switch", these events should end up in my "case default:",
but nothing ever shows up..  Any help appreciated..

-Dave

-- 
-* Dave Morgan                                    System Programmer
dmorgan@javelin.sim.es.com            Evans & Sutherland Computer Corporation
...uunet!javelin.sim.es.com!dmorgan         "Carpedium - Sieze the day"
Newsgroups: comp.sys.mac.programmer
From: keith@taligent.com (Keith Rollin)
Subject: Re: Gestalt, Think C and System 6
Followup-To: comp.sys.mac.programmer
Organization: Taligent
Date: Thu, 15 Oct 1992 22:47:11 GMT

In article <Bw68FB.6x9@news.cso.uiuc.edu>, resnick@cogsci.uiuc.edu (Pete
Resnick) wrote:
> 
> 2. I think Geoff is using the THINK C (i.e. MPW) Gestalt glue. I
> thought it would answer these calls appropriately. Maybe not?
> 

In general, the glue only answers questions that can be answered by calling
SysEnvirons. I think there is one selector implemented that doesn't rely on
SysEnvirons, but I can't remember what it is.

-----
Keith Rollin
Phantom Programmer
Taligent, Inc.
From: marshall@sdd.hp.com (Marshall Clow)
Newsgroups: comp.sys.mac.programmer
Subject: Re: DisposeHandle vs. ReleaseResource
Followup-To: comp.sys.mac.programmer
Date: 15 Oct 1992 20:55:45 GMT
Organization: Hewlett Packard San Diego Printer Division
Distribution: world
NNTP-Posting-Host: hpsdr160.sdd.hp.com

In article <1992Oct15.202020.17123@asuvax.eas.asu.edu>,
system@asuvax.eas.asu.edu (Marc Lesure) wrote:
> 
> I have a routine that deletes, adds, and updates a resource in a
> preference file.  The function performs what it is suppose to do, however
> it doesn't seem to release the memory (if I call the routine enough times,
> it dies with a dsMemFullErr).  I understand that you need to use
> ReleaseResource(), if the allocated handle came from GetResource().  But
> what if the handle is created via a NewHandle() call?
> 
> [ code deleted ]

Rule of thumb: If a handle refers to a resource, then use ReleaseResource. 
If it doesn't, then use DisposHandle. It doesn't matter how it was created.

DetachResource and RmveResource turn resource handles into a 
non-resource handle. AddResource turns a non-resource handle into a 
resource handle.

Even bigger rule of thumb: Check for errors!!!

Here lies one problem in your code:
>		RmveResource(aH);
>	 UpdateResFile(resFile);
>	 ReleaseResource(aH);
ReleaseResource does nothing if aH is not a handle to a resource.
ResError will tell you this. (See rule #2)


Marshall Clow
San Diego Printer Division      Hewlett Packard
Internet: marshall@sdd.hp.com   AppleLink: HP.Marshall    AOL: MClow
From: amanda@intercon.com (Amanda Walker)
Newsgroups: comp.sys.mac.programmer
Subject: Re: Virtual Serial Ports
Date: 12 Oct 1992 16:55:16 -0400
Organization: InterCon Systems Corporation
NNTP-Posting-Host: intercon.com

In article <scott.718793463@mcl> scott@mcl.ucsb.edu (Scott Bronson) writes:
>I assume RAMSDOpen is wholly obsolete, but even my
>super-thick new X-Ref can't tell me where to find more info on how to open
>and close a serial driver by its in and out name without conflicting with
>the ROM (?) driver.

Just use OpenDriver.  It will do the right thing.  I believe that this
is in the Question & Answer stack somewhere, but I have also found it
to be true in my own code.


Amanda Walker
InterCon Systems Corporation

Newsgroups: comp.sys.mac.programmer
From: d87abj@efd.lth.se (Anders Bjerken)
Subject: Graf3D - where is documentation?
Reply-To: d87abj@efd.lth.se
Organization: Lund Institute of Technology, Sweden
Date: Wed, 7 Oct 1992 14:33:48 GMT

I'm writing a program for defining Swivel command files using input from a VPL Data Glove and ordinary Swivel documents. As I don't want to spend time or money on implementing Super Ninja Mega Sega grapic effects, I'm looking for a shareware routine package that can draw simple wireframe structures fast.

I have run across the Graf3D interface for the MPW and Think environments, but where on earth can I find documentation??? The manuals don't say anything about it, and neither do the developers CDs I've scanned through.

Anyone, please help!!!

Anders Bjerke'n
Lund Institute of Technology
Newsgroups: comp.sys.mac.programmer
From: FNAHF@rose.uib.no ()
Subject: Gnuplot v3.0 pl1 for MPW available for anonymous ftp
Organization: University of Bergen, NORWAY
Date: Fri, 9 Oct 92 14:43:46 GMT
X-News-Reader: VMS NEWS 1.20

Gnuplot v 3, pl1 for MPW Available for anonymous ftp
----------------------------------------------------
 
I am making available a (pre)release, precompiled version of
Gnuplot 3.0, patchlevel 1 for MPW. Only the binaries are
released at this time to let me iron out eventual bugs, both
introduced by porting the code, and also in the Mac window
driver. This version has been compiled with -mc68020, -mc68881, and
-elems881 compiler options. Also I have used ColorQD routines. Therefore
a Mac with a 680[234]0, an FPU, and ColorQD is required to use this tool.
It has only been tested on a MacIIsi with FPU, 13" Apple RGB monitor, under
MPW 3.2. Usual disclaimers apply.
 
Please send good and bad reports to:
 
olaussen@cc.uib.no
 
MacBinary and binhexed versions can be obtained by anonymous ftp to:
 
ekman.nrsc.no (129.177.42.8)
 
in the directory /pub.
 
Have fun -- and PLEASE get back to me so that I can get the code released
ASAP. Thanks!!
 
Tor Olaussen
Nansen Environmental and Remote Sending Center
University of Bergen
Bergen, Norway
olaussen@cc.uib.no
From: cshotton@oac.hsc.uth.tmc.edu (Chuck Shotton)
Newsgroups: comp.sys.mac.programmer
Subject: Re: Apple Events! How to locate a service?
Date: 8 Oct 1992 21:00:25 GMT
Followup-To: comp.sys.mac.programmer
Organization: Academic Computing

In article <D88-JWA.92Oct8204556@byse.nada.kth.se>,
d88-jwa@byse.nada.kth.se (Jon Wtte) wrote:
> 
> And still we don't have a good service dictionary in the system.
> Anyone care to try and position the HLE and the AE in the OSI
> stack? PPC should be at the same level as TCP, i.e. level 3 ?
> (starting at 0)
> 

AE.... Session level.

--_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
Chuck Shotton                      |    
Ass't Director, Academic Computing |       "This space for rent."
UT Health Science Center Houston   |  
cshotton@oac.hsc.uth.tmc.edu       |         
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
Newsgroups: comp.sys.mac.programmer
From: keith@taligent.com (Keith Rollin)
Subject: Re: UnloadSeg and pointers to functions
Followup-To: comp.sys.mac.programmer
Organization: Taligent
Distribution: na
Date: Thu, 15 Oct 1992 23:24:43 GMT

In article <1992Oct15.181940.2146@news.columbia.edu>,
sll2@cunixa.cc.columbia.edu (Steven L Levitt) wrote:
> 
> 	If I have a structure on the heap which contains a point
> function and I call UnloadSeg() on the segment which contains that 
> function, will the pointer still be valid afterward?  I would like to call
> UnloadSeg() each time through the main event loop, but I don't know if the Jump
> Table scheme the mac employes will preserve the validity of my f
> pointers.

The pointer should remain valid. If you take the address of a function, the
compiler will generate a jump table entry for that function. The function
pointer will then, in fact, point to the jump table entry.

-----
Keith Rollin
Phantom Programmer
Taligent, Inc.
From: peirce@outpost.SF-Bay.org (Michael Peirce)
Newsgroups: comp.sys.mac.programmer
Subject: Re: Telling the Finder to update a file's type & creator
Date: 12 Oct 92 15:50:55 GMT
Reply-To: peirce@outpost.SF-Bay.org (Michael Peirce)
Organization: Peirce Software
X-Mailer: uAccess - Macintosh Release: 1.6v1


In article <1992Oct12.065332.4638@cs.uoregon.edu> (comp.sys.mac.programmer), mkelly@mystix.cs.uoregon.edu (Michael A. Kelly) writes:
> 
> Hi everyone,
> 
> I'm writing yet another program to change a file's type and creator.  I would
> like to tell the Finder to immediately update the file's icon and/or Kind
> when I change the type and/or creator.  I know it's possible, because
> Now Utilities' StartUp Manager does it when it turns extensions on and off,
> but I can't find anything in the literature that tells how to do it.  Perhaps
> I just haven't dug deep enough, but I'm hoping someone can just tell me
> how to do it, or where I can find that information.

You need to set the modify date of the parent directory.  Use something
like this:

    stat = PBSetCatInfo(&aCPB,false);
								
    aCPB.hFileInfo.ioCompletion	= nil;
    aCPB.hFileInfo.ioNamePtr	= nil;
    aCPB.hFileInfo.ioVRefNum	= outReply.sfFile.vRefNum;
    aCPB.hFileInfo.ioDirID		= outReply.sfFile.parID;
    aCPB.hFileInfo.ioFDirIndex	= -1;
								
    GetDateTime(&now);
    aCPB.dirInfo.ioDrMdDat = now;
								
    stat = PBSetCatInfo(&aCPB,false);

--  Michael Peirce      --   peirce@outpost.SF-Bay.org
--  Peirce Software     --   Suite 301, 719 Hibiscus Place
--                      --   San Jose, California USA 95117
--  Makers of...        --   voice: (408) 244-6554 fax: (408) 244-6882
--            SMOOTHIE  --   AppleLink: peirce & America Online: AFC Peirce
From: mssmith@afterlife.ncsc.mil (M. Scott Smith)
Newsgroups: comp.sys.mac.programmer
Subject: More GWorld/animation ?'s
Date: 13 Oct 92 19:42:03 GMT
Organization: The Great Beyond

My quest to become fluent in the art of doing flicker-free animation on
the Mac continues..

A few questions:

- I made a test program which had three color images; their pict files
  are maybe 10k each (pretty small).  I believe I set up a GWorld the
  size of the picture (in pixels, also pretty small).  With 3 images and
  3 GWorlds, it seemed fine, but when I added a fourth I suddenly needed
  to increase the memory allocated to the program, by quite a bit (much
  more than 11k; maybe 200 or so.)

  I may have possibly set the GWorld to a larger size than I just said
  I did; but, irregardless, is a GWorld generally set up for each
  picture that is a frame of an animation sequence?  How much memory
  do these GWorlds require, and what kinds of things do I need to take
  into consideration?

- A few months back I was bored and was snooping around files with ResEdit.
  I noticed the Boris screen saver module for After Dark contained lots
  of PICT resources, each with a separate frame of animation for the cat
  and butterfly, both in color and black and white.  I also noticed that
  for every image, there was an image which was identical but was solid
  black.  (So, for example, there was a color picture of the cat, and then
  a black silhouette of the cat.)

  I've been trying to think of why this would be done; does anyone know?
  I am very impressed with the smooth animation of the Boris AD module,
  and I'd be perfectly happy with animation of that quality.  (Do you
  think that uses GWorlds and similar techniques, or direct-screen writing?)

- And finally, I am open to ANY comments anyone has on doing animation --
  I'd love to hear any tips, suggestions, etc. on any aspect of it.  Source
  code would be great as well.  My initial inquiries prompted quite a few
  responses of people who would like to learn anything I learned, and I'd
  like to assemble a small article which walks a programmer through doing
  animation on the Mac.  (Such an article, as far as I can tell, doesn't
  exist, and would have made my learning a lot easier.)  If anyone wants
  to help out with that, let me know.

Thanks!

M. Scott Smith
  (mssmith@afterlife.ncsc.mil | umsmith@mcs.drexel.edu)
From: chuck@gte.com (Chuck Hoffman)
Newsgroups: comp.sys.mac.programmer
Subject: Re: Corporate developer's association?
Date: 8 Oct 92 13:32:45 GMT
Followup-To: comp.sys.mac.programmer,comp.sys.mac.misc,comp.sys.mac.hypercard
Organization: GTE Laboratories

In article <01050023.fgva41@chinchilla.cars.com>, niel@cars.com (Niel
Bornstein) wrote:
> 
> Does anyone know of any kind of organization or conference for in-house
> developers?  I know there are users' groups for users, and there is MacIS
> for managers, and there are conferences for low-level bits-and-bytes
> programmers, but what about us guys who put together databases and
> HyperCard stacks and other 4GL type stuff for in-house use?  
> 
> I'm dying to talk to some other folks who do waht I do, but there doesn't
> seem to be any forum for it...
> 

I develop both in-house and outside.  If you got a conference organizing
company to put something on, I would attend.  Especially in Atlanta. 
Especially at World Series time.

Chuck Hoffman
chuck@gte.com
GTE Laboratories, Waltham, Massachusetts, USA
(617) 466-2131
=====================================
I'm not sure why we're here, but I am sure that while we're here we're
supposed to help each other.
=====================================
From: mxmora@unix.sri.com (Matthew Xavier Mora)
Newsgroups: comp.sys.mac.programmer
Subject: Re: SpaceWar!
Date: 12 Oct 92 17:11:48 GMT
Followup-To: comp.sys.mac.programmer
Organization: SRI International

In article <1992Oct8.195445.14057@aoa.aoa.utc.com>, davidt@aoa.aoa.utc.com
(David Trefrey) wrote:
> 
> 	Pretty cool game, binary's awful big though ( > 400KB ).  Would
> 	like to get a look at the source for it.  Good animation and 
> 	really good sound effects.
> 

Its big because all his sprites are color icons. (icl*) 

Its a nice first effort but I think it has some minor problems.

1. A space game with a white background?
2. When sprites overlap you can see the square masking.
3. Space ship doesn't respond to keys very well.
4. spaceship doesn't stop moving when you let go of a key.
5. scoring goes negative?
6. No mouse support?
7. Very Close to Solarian? Almost too close?
8. Better window support.

I think he did a good job. Consider it constructive critisizm. :-)


--
----------------------------------------------------------------------
Matthew Xavier Mora                                mxmora@unix.sri.com
SRI International                                       (415) 859-5011
----------------------------------------------------------------------
Newsgroups: comp.sys.mac.programmer
From: bergstrm@casbah.acns.nwu.edu (Todd Bergstrom)
Subject: HELP PixMaps
Organization: Northwestern University, Evanston Illinois.
Distribution: comp.sys.mac.programmer
Date: Mon, 12 Oct 1992 19:48:31 GMT


I am having trouble working with PixMaps.  I want to perform simple operations
such as CopyPixMap to transfer one window to another.  I am getting no
apparent errors but am unable to see any results either.  Any suggestions or
sample code would be much appreciated.

Thanks,
Todd
email Bergstrm@casbah.acns.nwu.edu
Newsgroups: comp.sys.mac.programmer
From: ksand@apple.com (Kent Sandvik)
Subject: Re: Tech-note 31
Date: Wed, 14 Oct 1992 05:04:59 GMT
Organization: Apple
Followup-To: comp.sys.mac.programmer

In article <1992Oct05.005354.10663@edsi.plexus.COM>,
trimper@edsi.plexus.COM (Greg Trimper) wrote:
> > I'm desparately trying to find a copy of Tech-Note 31. I asked UK DTS,
> >and all they said was "Moof!" 

> >Can anybody help?

> Try the Tech Notes stack.  
TN31 is easy to get, but try to get TN299 :-).

Cheers,
Kent
proud father of former TN300. BTW, TN numbering will get back (bliss).
-------------------
Kent Sandvik (UUCP: ....!apple!ksand; INTERNET: ksand@apple.com)
DISCLAIMER: Private activities on the Net.
Newsgroups: comp.sys.mac.programmer
From: tree@newton.uvm.edu (Tom Emerson)
Subject: Re: THINK C bug AGAIN
Followup-To: comp.sys.mac.programmer
Organization: University of Vermont, EMBA Computer Facility
	<Bw4DGs.Gyz@news.cso.uiuc.edu> <de19-151092073358@mac19-pg2.umd.edu>
Date: Thu, 15 Oct 1992 14:06:32 GMT

Hi Dana,

As a matter of fact, we have replicated the bug and it is being addressed. As
you know, I can't comment on when (or even if, but...) this will be fixed.
However, we do know there is a problem in the code motion global optimization,
and that if you turn this off the code should work correctly.

Tom
--
   Tom Emerson                                    Technical Support
   Language Products Group                     Symantec Corporation
                         Internet: tree@uvm.edu
Newsgroups: comp.sys.mac.programmer
From: bcaesar@comanche.ess.harris.com (Bob Caesar)
Subject: AppleDouble format?  AppleSingle-AppleDouble.img? 
Date: Fri, 16 Oct 1992 17:20:42 GMT
Reply-To: bcaesar@comanche.ess.harris.com
Organization: Harris Corporation, Government Aerospace Systems Division
Keywords:  .img file, AppleShare, Type: SIMA  Creator: GEOL

I'm trying to figure out the format of the Mac files on our Suns.  We are using
a gatorbox.  The files are apparently in AppleDouble format ( data in "file" and
finderinfo/resource in "%file").  I grabbed a copy of AppleSingle-AppleDouble.img
from ftp.apple.com  /dts/docs.  What utility is required to read this?  It looks like
the type is "SIMA" and the creator is "GEOL".   Does anyone happen to have an ascii
version they could mail me?  I'd really appreciate it.

I'm planning to modify a copy of mcvert and unsit so they will output in AppleDouble
format.

Thanks,

Bob
---
Robert J. Caesar Jr.
<bcaesar@comanche.ess.harris.com>        VLSI Technology, Inc.
PHONE: (407) 727-6398   [727-NEXT]       2200 Park Central North, Suite 600
PHONE: (305) 971-0404                    Pompano Beach, Florida  33064
Newsgroups: comp.sys.mac.programmer
From: ralex@tigger.cs.Colorado.EDU (Repenning Alexander)
Subject: Dynamic Change of Mouse Tracking Speed
Organization: University of Colorado, Boulder
Date: Tue, 13 Oct 1992 19:30:09 GMT


I am dealing with the visual representation of complex data structures.
I like to experiment with the Mouse Tracking Speed to make it easier
for users to track on important information: "soft snapping".

Is there some simple way to change the mouse tracking speed (e.g. via
a trap)?  What I need is a function allowing me to adjust mouse
tracking to speeds like the ones avaivable in the MOUSE CDEV (very
slow, .., fast). How is the MOUSE CDEV doing it?

Any ideas, clues?

  Thanks,  Alex
From: mgeorgy@vmsclst1.sc.csupomona.edu
Newsgroups: comp.sys.mac.programmer
Subject: Novice Needs help with input!!!!!!
Date: 9 Oct 92 20:30:22 GMT
Article-I.D.: vmsclst1.1992Oct9.133022.1
Organization: Computer Science Computational Systems
Nntp-Posting-User: mgeorgy

Hello, I need a little help on obtaining input from the screen.  Can someone
please explain to me the options available to me and how I can implement them. 
The type of input required is at most a one word command, at which point my
program will do one thing or another.  I am not yet proficient enough to use
menus in my program other wise I would.  Maybe if someone has a little time
they can explain the use of menus????

Thanx,
Matt Georgy
California State Polytechnic University, Pomona  --  Computer Science
From: mxmora@unix.SRI.COM (Matt Mora)
Newsgroups: comp.sys.mac.programmer
Subject: Re: Memory Manager-safe Deferred Tasks - A Proposal
Date: 15 Oct 92 16:13:47 GMT
Organization: SRI International, Menlo Park, California

In article <1992Oct14.141151.5753@cs.tulane.edu> mandel@tmc.tulane.edu (Jeff E Mandel) writes:

>Well, I have done stuff like this in a driver, and you still have the
>same problem - someone has to call SystemTask for the driver to get
>called, and you can't always depend on it happening as often as you want.


Set up a vbltask and call it every few ticks. Its not on any of the lists
that says it moves memory or cannot be called at interupt time. :-)





Matt
-- 
___________________________________________________________
Matthew Mora                |   my Mac  Matt_Mora@sri.com
SRI International           |  my unix  mxmora@unix.sri.com
___________________________________________________________
Newsgroups: comp.sys.mac.programmer
From: d88-jwa@byse.nada.kth.se (Jon Wtte)
Subject: Re: Creating files (where did it go?)
Originator: d88-jwa@byse.nada.kth.se
Organization: Royal Institute of Technology, Stockholm, Sweden
Date: Tue, 13 Oct 1992 09:35:52 GMT

> essam@gagme.chi.il.us (Essam Khairullah) writes:

   So, I decided to use the officially sancioned FindFolder to locate the Prefs
   folder.  Of course, this returns a directory ID (not a working directory ID)

Good move, users outside of the US will like that a lot.

   so I have to use the PBH---- series of calls to open/create the file.

You don't need PBHXXX calls, there's glue for the HXXX calls.
So you do this:

	int fRefNum = 0 ;

	HCreate ( vRefNum , dirID , fName , type , creator ) ;
	HCreateResFile ( vRefNum , dirID , fName ) ;
	err = HOpen ( vRefNum , dirID , fName , fsRdWrPerm , & fRefNum ) ;
	if ( ! err ) {

		...
	}
	if ( fRefNum ) {

		FSClose ( fRefNum ) ;
		fRefNum = 0 ;
	}
-- 
 -- Jon W{tte, h+@nada.kth.se, Mac Hacker Suedoise (not french speaking) --

   There's no problem that can't be solved using brute-force algorithms
   and a sufficiently fast computer. Ergo, buy more hardware.
Newsgroups: comp.sys.mac.programmer