This is the mail archive of the
mailing list for the Cygwin project.
Re: Setup Query for Gary: FreeResource
- From: "Max Bowsher" <maxb at ukf dot net>
- To: "Gary R. Van Sickle" <g dot r dot vansickle at worldnet dot att dot net>,"Cygwin Apps" <cygwin-apps at cygwin dot com>
- Date: Sat, 2 Aug 2003 12:10:55 +0100
- Subject: Re: Setup Query for Gary: FreeResource
- References: <NCBBIHCHBLCMLBLOBONKKEMOEGAA.email@example.com>
Gary R. Van Sickle wrote:
>> Robert Collins wrote:
>>> On Sat, 2003-08-02 at 05:16, Max Bowsher wrote:
>>>> According to the MS docs, FreeResource is an obsolete 16-bit
>>>> function. Do we really want/need to use it?
>>> MS recommend using DeleteIcon etc rather than it for new code - and
>>> yes, its nice to free resources we've used :}.
> Trouble is, its a dialog template that I'm loading, and there's no
> "DestroyDialog()" or something to otherwise do the job.
>> Well, yes, obviously, its nice, but will FreeResource do it? In the
>> docs I was looking at, FreeResource wasn't even documented - just
>> in a list of obsolete functions. It is documented in MSDN - as being the
>> complement to LoadResource.
> Yep, thusly:
> "The FreeResource function is obsolete and is only supported for backward
> compatibility with 16-bit Microsoft® Windows®."
> Sheesh, I must be getting old!
>> We can only guess how LockResource fits into
>> this picture.
> No need to guess, my good man!:
> "The return type of LoadResource is HGLOBAL for backward compatibility,
> because the function returns a handle to a global memory block. Do not
> this handle to the GlobalLock or GlobalFree function. To obtain a pointer
> the resource data, call the LockResource function."
> "The pointer returned by LockResource is valid until the module containing
> resource is unloaded. It is not necessary to unlock resources because the
> system automatically deletes them when the process that created them
> As I assume is clear, the only reason I'm dinking with these templates at
> is to get the original size of the various pages as specified in res.rc.
> think the FreeResource() should be left in unless it causes problems, or
> until a better way can be found to get the needed info, and I did do
> considerable research to those ends and came up empty.
OK, I just wanted this to be discussed.
Now it has been, I'm happy.