[futurebasic] [Q] HLOCK vs SetResAttrs

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : January 1998 : Group Archive : Group : All Groups

From: Mel and Carol <mel@...>
Date: Mon, 12 Jan 1998 16:53:30 -0800
For a long time I have been reading resources and normally making them hang
around in memory using the toolbox call "FN HLOCK(Hndl&)". While it seems
to work, I was looking at SETRESATTRS today and wondering if perhaps with
resources it should be done that way instead.

In other words, for Handles you create using NEWHANDLE, you use
HLOCK/HUNLOCK. But for resources you read in (GETRESOURCE) you should use

So which is the right way? Or does it matter?

My reason for asking is that I was writing a print routine to send a TEXT
resource to a printer. It works fine on every printer except an HP inkjet.
It would print garbage on the inkjet each time not the text. Turned out,
when the printer driver started it Purged Memory and removed/moved my
resource (but the resource handle was still good).

I did have it loaded and it was HLOCKed. Would SetResAttrs have prevented this?

Mel Patrick - theWabbitGuy - mel@...