Re: NSData to IconFamilyHandle woes
Re: NSData to IconFamilyHandle woes
- Subject: Re: NSData to IconFamilyHandle woes
- From: Colin Cornaby <email@hidden>
- Date: Thu, 18 Aug 2005 18:03:48 -0700
Ah. This I had also tried. But...
OSErr theErr=noErr;
IconSuiteRef theBlankSuite;
Handle theHandle = NewHandle([[resourceToSet resourceData]
length]);
BlockMove([[resourceToSet resourceData] bytes], *theHandle,
[[resourceToSet resourceData] length]);
NSLog(@"size=%d", GetHandleSize(theHandle));
IconFamilyHandle iconFamily;
theErr=NewIconSuite(&theBlankSuite);
NSLog(@"theErr=%d",theErr);
theErr=IconSuiteToIconFamily
(theBlankSuite,svAllAvailableData,&iconFamily);
NSLog(@"theErr=%d",theErr);
theErr=SetIconFamilyData (iconFamily, 'icns', theHandle);
NSLog(@"theErr=%d",theErr);
myIconFamily = [[IconFamily alloc]
initWithIconFamilyHandle:iconFamily];
First results an an error -108 from IconSuiteToIconFamily, and then
the usual error -5 for SetIconFamilyData.
On Aug 18, 2005, at 5:57 PM, glenn andreas wrote:
On Aug 18, 2005, at 7:52 PM, Colin Cornaby wrote:
I'm trying to use the following code to take data from an icns
file and move it into an IconFamilyHandle:
OSErr theErr=noErr;
Handle theHandle = NewHandle([[resourceToSet resourceData]
length]);
BlockMove([[resourceToSet resourceData] bytes], *theHandle,
[[resourceToSet resourceData] length]);
NSLog(@"size=%d", GetHandleSize(theHandle));
IconFamilyHandle iconFamily= (IconFamilyHandle) NewHandle(0);
theErr=SetIconFamilyData (iconFamily, 'icns', theHandle);
NSLog(@"theErr=%d",theErr);
myIconFamily = [[IconFamily alloc]
initWithIconFamilyHandle:iconFamily];
The initial handle has a size, but when I attempt to copy the
initial handle into an IconFamily handle it returns an error
negative -50, or a parameter error. Searching the list shows
everyone else who has tried this getting stuck at the exact same
point. Did anyone ever resolve this?
NewHandle(0) does not a valid IconFamilyHandle make!
You need to use NewIconSuite.
Glenn Andreas email@hidden
<http://www.gandreas.com/> wicked fun!
Widgetarium | the quickest path to widgets
---------------------------
Colin Cornaby
ProToys - White Magic Labs - http://whitemagiclabs.com
Macintosh Specialist - University of Portland - htttp://up.edu
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden