Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: How to add Application Icon in About window for Carbon App in Nib file?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to add Application Icon in About window for Carbon App in Nib file?



I tried as you said, but SetControlData return err -30591, where I was
wrong?
I am sure the IconRef I get was correct.
Because I can use PlotIconRef to display the icon.
/
/-----------------------------------------------------------------------
------------------------------------------
static const ControlID kAboutBoxIconID = { 'abou', 5 }; //same with
icon control in IB
OSStatus err = noErr;
ProcessSerialNumber psn = { 0, kCurrentProcess };
ControlRef iconControl;
FSRef ref;
FSSpec appFileSpec;
IconRef iconRef;

if(err == noErr)
err = GetProcessBundleLocation( &psn, &ref );

if(err == noErr)
err = FSGetCatalogInfo( &ref, kFSCatInfoNone, NULL, NULL,
&appFileSpec, NULL );

if( err == noErr )
err = GetIconRefFromFile ( (const FSSpec *) &appFileSpec,
&iconRef, nil );

if(err == noErr)
err = GetControlByID( gAboutWindow, &kAboutBoxIconID, &iconControl );

if( err == noErr )
err = SetControlData( iconControl, 0, kControlIconContentTag,
sizeof(IconRef), (Ptr) &iconRef );
/
/-----------------------------------------------------------------------
------------------------------------------

On Friday, December 20, 2002, at 03:26 PM, Eric Schlegel wrote:

> On Thursday, December 19, 2002, at 07:39 PM, jackzhu wrote:
>
>> Hi,
>> I am trying to make my app agree with the Aqua Human Interface
>> Guidelines.
>> I just do not know how to do it in InterfaceBuilder in my Carbon
>> Application.
>
> Unfortunately this is somewhat complex right now and can't be done
> entire in IB.
>
> I think the easiest way to do it is:
>
> - create an Icon control in IB and give it a control ID
> - when you load the About box window from the nib, find the icon
> control using GetControlByID
> - get an FSRef to your application with:
>
> ProcessSerialNumber psn = { 0, kCurrentProcess );
> FSRef ref;
> GetProcessBundleLocation( &psn, &ref );
>
> - get the IconRef for your application with GetFSRefForFileInfo
> - set the IconRef on the icon control with SetControlData using the
> kControlIconContentTag selector
>
> -eric
> _______________________________________________
> 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.
_______________________________________________
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: 
 >Re: How to add Application Icon in About window for Carbon App in Nib file? (From: Eric Schlegel <email@hidden>)



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

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.