Codejock Forums Homepage
Forum Home Forum Home > General > XAML Snippets
  New Posts New Posts RSS Feed - MFC using xaml for HICON
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

MFC using xaml for HICON

 Post Reply Post Reply
Author
Message
Duane View Drop Down
Groupie
Groupie
Avatar

Joined: 16 May 2023
Location: Montreal
Status: Offline
Points: 13
Post Options Post Options   Thanks (0) Thanks(0)   Quote Duane Quote  Post ReplyReply Direct Link To This Post Topic: MFC using xaml for HICON
    Posted: 19 May 2023 at 11:34am
How can I create an HICON from an  XAML resource?

I've tried

HICON hIcon = (HICON)::LoadImage(theApp.m_hInstance, MAKEINTRESOURCE(IDR_LOGO), IMAGE_ICON, szIcon.cx, szIcon.cy, LR_SHARED);

But hIcon here is NULL.  

Is this possible?  I am able to add that resource to an image vector and use it for a ribbon without problem.
Back to Top
astoyan View Drop Down
Admin Group
Admin Group
Avatar

Joined: 24 August 2013
Status: Offline
Points: 304
Post Options Post Options   Thanks (0) Thanks(0)   Quote astoyan Quote  Post ReplyReply Direct Link To This Post Posted: 28 May 2023 at 3:40pm
Hello Duane,

It is possible to make an HICON from XAML by rendering XAML into a bitmap and then making an icon from that bitmap manually. But that is not only a tedious work, but also a useless and pointless one as the whole point of having XAML icons is to ensure that you need only one XAML image to handle or possible icon sizes and to ensure a crisp and scalable image. Look for SetVectorIcon calls in ToolkitPro samples, like RibbonSample and similar.

Regards,
   Alexander
Back to Top
Duane View Drop Down
Groupie
Groupie
Avatar

Joined: 16 May 2023
Location: Montreal
Status: Offline
Points: 13
Post Options Post Options   Thanks (0) Thanks(0)   Quote Duane Quote  Post ReplyReply Direct Link To This Post Posted: 29 May 2023 at 8:43am
Thanks for the reply.  I guess my question was poorly worded.  I am not specifically looking to convert an XAML into an HICON.  I want to be able to use the XAML as the frame icon.  I am able to use SetVectorIcon for the ribbon without problem.  But the frame icon in the sample is using CXTPFramePaintManager.  And this doesn't have a SetVectorIcon member.  
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.188 seconds.