[haiku-3rdparty-dev] Loading an app's own icon

  • From: "Humdinger" <dmarc-noreply@xxxxxxxxxxxxx> (Redacted sender "humdingerb" for DMARC)
  • To: haiku-3rdparty-dev@xxxxxxxxxxxxx
  • Date: Mon, 25 Apr 2016 17:02:48 +0200

Hi there!

I'd like to show my app's own icon. In the rdef, the vector item is defined as:

resource vector_icon {...}

Loading it via:

const uint8* data
= (const uint8*)resources->LoadResource(B_VECTOR_ICON_TYPE,
"vector_icon", &size);

doesn't work.

When changing the rdef to:

resource(0, "vector_icon") #'VICN' array {...}

the above code works, but building the app results in an executable
without icon.


I work around the issue by changing the code to use the ID "101" I
figured out using QuickRes:

const uint8* data
= (const uint8*)resources->LoadResource(B_VECTOR_ICON_TYPE,
101, &size);

Hard-coding the ID feels wrong. What's the correct way?
Thanks!

Regards,
Humdinger

--
Did you know:
  If half the Haiku supporters at http://www.goodsearch.com
  made 10 searches a day, we could have a fulltime developer.

Other related posts: