Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to get the info from a handle?



Cc: email@hidden
From: David Duncan <email@hidden>
Subject: Re: How to get the info from a handle?
Date: Thu, 27 Nov 2003 18:42:43 -0500
To: Mark <email@hidden>

On Nov 27, 2003, at 04:43 PM, Mark wrote:

As Larry said, GetDataBrowserItems() expects an allocated handle (it
will resize it to match the number of items returned).

Handle h = ::NewHandle(0);
::GetDataBrowserItems(browser, kDataBrowserNoItem, false,
kDataBrowserItemIsSelected, &h);

If I remember correctly, OS X doesn't like handle sizes set to zero. I
am not 100% sure about this

I can't say I've ever had issues with 0 sized handles on OS X. However,
there are differences in how 0 sized pointers may be dealt with
depending on OS (at least as I'm remembering in the past) as some
libraries return NULL while others return a valid pointer.
0 sized handles are fine, and the above is the right way of getting data browser items (except that you pass h, not &h)
http://developer.apple.com/qa/qa2001/qa1259.html summarises the situation as to what happens when allocating 0 bytes of memory with different APIs

Fred
_______________________________________________
carbon-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/carbon-development
Do not post admin requests to the list. They will be ignored.



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.