This is the mail archive of the cygwin-apps@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Setup Query for Gary: FreeResource


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
>> compatibility
>>>> 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
offline
>> docs I was looking at, FreeResource wasn't even documented - just
mentioned
>> 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,
not
> because the function returns a handle to a global memory block. Do not
pass
> this handle to the GlobalLock or GlobalFree function. To obtain a pointer
to
> the resource data, call the LockResource function."
>
> "The pointer returned by LockResource is valid until the module containing
the
> resource is unloaded. It is not necessary to unlock resources because the
> system automatically deletes them when the process that created them
> terminates."
>
> As I assume is clear, the only reason I'm dinking with these templates at
all
> is to get the original size of the various pages as specified in res.rc.
I
> 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.

Max.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]