On 16/01/07, Tomas Zahradnicky <email@hidden> wrote:
Because I didn't want to include m files in the project and wanted to
show it is possible from C.
Well, it certainly is possible, but it's not that pretty. You'll need
to link in the Cocoa framework to your project, or load it up via the
CFBundle APIs. You also probably need to deal with the auto release
pool using the same mechanics shown below. This is all typed in Mail,
and so hopefully it compiles, but if not hopefully it at least shows
you the concept behind it.
For even more fun times of beating multiple dead horses, you can even
load these methods up dynamically and call into Objective-C from PEF
applications <evil grin>. However, even with the above code, it is
*infinitely* easier to simply write:
int WindowGetWindowNumber( WindowRef win )
{
NSWindow *win = [NSWindow initWithWindowRef:win];
int out = [win windowNumber];
[win release];
return out;
}
When knowing that I need to maintain code, I'd opt for the latter any
day.
HTH,
Jon
--
Jonathan Johnson
email@hidden
REAL Software, Inc.
_______________________________________________
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