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?



On Nov 27, 2003, at 12:36 PM, ai cui wrote:

I need to delete the selected items in my browserdata.
Here is the way I did:

//I got a handle from the API :
Handle handle_selectedItems;
GetDataBrowserItems(browser, kDataBrowserNoItem,
false,
kDataBrowserItemIsSelected,handle_selectedItems);

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);

//and I want to pass the handle to the API:

RemoveDataBrowserItems(browser,kDataBrowserNoItem,
selectionCount, handle_selectedItems,NULL);

And RemoveDataBrowserItems() expects a pointer to the items to remove, thus you need to dereference the handle first.

RemoveDataBrowserItems(browser, kDataBrowserNoItem, selectionCount, (DataBrowserItemID*)*h, NULL);

How can I get the info from the handle?

For future reference, a Handle is merely a double-pointer (specifically char** for the Handle type). Thus if you want to get the data in a handle, you need to dereference twice.
--
Reality is what, when you stop believing in it, doesn't go away.
Failure is not an option. It is a privilege reserved for those who try.

David Duncan
_______________________________________________
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.

References: 
 >How to get the info from a handle? (From: ai cui <email@hidden>)



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.