You might have some luck leaning on the objc runtime:
For any Objective C object, what you have is actually a pointer to
struct objc_object
{
struct objc_class *isa;
/* …variable length data containing instance variable values… */
};
In the real world you never have an instance of NSView, but an
instance of a subclass of NSView. I suppose you could use
objc_getClassList to get all loaded classes, iterate over them to
find those that are subclasses of NSView and stash away all of those
values. If ((struct objc_object*)my_magic_pointer)->isa is equal to
any of those values then there is a reasonable chance that what
you've got is an instance of that class. This of course assumes that
the thing you've got is actually a pointer.
Fred
On 30 Aug 2007, at 13:59, Mike Kluev wrote:
What's the best way to distinguish between ControlRef vs NSView* at
runtime?
IsValidControlHandle/HIViewIsValid?
Mike
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/carbon-dev/frederick.cheung%
40gmail.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden
This email sent to email@hidden