Print Page | Close Window

SetIcons from resource DLL?

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=17358
Printed Date: 19 June 2025 at 1:33pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: SetIcons from resource DLL?
Posted By: evoX
Subject: SetIcons from resource DLL?
Date 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)



Replies:
Posted By: Oleg
Date 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


Posted By: evoX
Date 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)


Posted By: Oleg
Date 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


Posted By: evoX
Date Posted: 04 October 2010 at 12:21pm
Thanks ! Smile

-------------
Product: Xtreme ToolkitPro 19.30
Platform: Windows 10 64bit
Language: Visual C++ (VS 2019)


Posted By: evoX
Date 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)


Posted By: ddlittle
Date 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);


Posted By: evoX
Date 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)



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net