Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - SetIcons from resource DLL?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

SetIcons from resource DLL?

 Post Reply Post Reply
Author
Message
evoX View Drop Down
Senior Member
Senior Member
Avatar

Joined: 25 July 2007
Status: Offline
Points: 207
Post Options Post Options   Thanks (0) Thanks(0)   Quote evoX Quote  Post ReplyReply Direct Link To This Post Topic: SetIcons from resource DLL?
    Posted: 01 October 2010 at 12:43am
How can I load bitmaps from a Resource DLL file for Markup?
I have this, but I want to load the bitmap from a different DLL.
XTPImageManager()->SetIcons(IDB_PNG_XAML_SYSINFO, &nIDSysInfo, 1, 0);
Product: Xtreme ToolkitPro 19.30
Platform: Windows 10 64bit
Language: Visual C++ (VS 2019)
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 04 October 2010 at 2:45am
Hi,

You can first load bitmap and add it with XTPImageManager()->SetIcons(&bmp, ...) method.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
evoX View Drop Down
Senior Member
Senior Member
Avatar

Joined: 25 July 2007
Status: Offline
Points: 207
Post Options Post Options   Thanks (0) Thanks(0)   Quote evoX Quote  Post ReplyReply Direct Link To This Post Posted: 04 October 2010 at 5:45am
Hi,
Is there a function in ToolkitPro to load the bitmap from a different resource DLL or I need to make my own?
Product: Xtreme ToolkitPro 19.30
Platform: Windows 10 64bit
Language: Visual C++ (VS 2019)
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 04 October 2010 at 8:19am
Hi,

you can use static
HBITMAP CXTPImageManagerIcon::LoadBitmapFromResource(HMODULE hModule, LPCTSTR lpszResource, BOOL* lbAlphaBitmap); method.

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
evoX View Drop Down
Senior Member
Senior Member
Avatar

Joined: 25 July 2007
Status: Offline
Points: 207
Post Options Post Options   Thanks (0) Thanks(0)   Quote evoX Quote  Post ReplyReply Direct Link To This Post Posted: 04 October 2010 at 12:21pm
Thanks ! Smile
Product: Xtreme ToolkitPro 19.30
Platform: Windows 10 64bit
Language: Visual C++ (VS 2019)
Back to Top
evoX View Drop Down
Senior Member
Senior Member
Avatar

Joined: 25 July 2007
Status: Offline
Points: 207
Post Options Post Options   Thanks (0) Thanks(0)   Quote evoX Quote  Post ReplyReply Direct Link To This Post Posted: 30 January 2011 at 11:02am

I have tried this, but it does not work :(

 

UINT nIDSysInfo=1;

hResourceInstance=LoadLibrary(_T("HardRes.dll"));

bmpChassis.FromHandle(CXTPImageManagerIcon::LoadBitmapFromResource(hResourceInstance, MAKEINTRESOURCE(IDB_LOGO_CHASSIS), &bAlpha));

XTPImageManager()->SetIcons(bmpChassis, &nIDSysInfo, 1, CSize(70,107)); // if I use bmpChassis.GetDimensions() instead of CSize it crashes

FreeLibrary(hResourceInstance);

Product: Xtreme ToolkitPro 19.30
Platform: Windows 10 64bit
Language: Visual C++ (VS 2019)
Back to Top
ddlittle View Drop Down
Senior Member
Senior Member


Joined: 19 February 2004
Location: United States
Status: Offline
Points: 132
Post Options Post Options   Thanks (0) Thanks(0)   Quote ddlittle Quote  Post ReplyReply Direct Link To This Post Posted: 30 January 2011 at 2:03pm
Here's a couple of ways I do this in my code.  Hope it helps..
 
My icons are .ICOs in a resource file, loaded like this:
 

CXTPImageManagerIconHandle hIcon;

hIcon.CreateIconFromResource(iconInst,MAKEINTRESOURCE(iconIds[x].icon),sz32, TRUE);

XTPImageManager()->SetIcon(hIcon,iconIds[x].cmd);

I load a PNG and attach it to my menu with this code:
    UINT nCommands2[] = {IDB_LOGO};
    CXTPImageManagerIcon hIcon(IDB_LOGO,0,0);
    BOOL b = TRUE;
    HBITMAP bm = hIcon.LoadBitmapFromResource(instResource,MAKEINTRESOURCE(IDB_C2RLOGO),&b);
    CBitmap cbm;
    cbm.Attach(bm);
    b = GetCommandBars()->GetImageManager()->SetIcons(cbm, nCommands2,_countof(nCommands2) ,CSize(0,0), xtpImageNormal, TRUE);
    FreeLibrary(instResource);
Back to Top
evoX View Drop Down
Senior Member
Senior Member
Avatar

Joined: 25 July 2007
Status: Offline
Points: 207
Post Options Post Options   Thanks (0) Thanks(0)   Quote evoX Quote  Post ReplyReply Direct Link To This Post Posted: 30 January 2011 at 3:56pm
thanks, with Attach bitmap it worked.
Product: Xtreme ToolkitPro 19.30
Platform: Windows 10 64bit
Language: Visual C++ (VS 2019)
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.063 seconds.