Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic How to LoadPicFromRes from a dll file? (Read 2353 times)
Joanna
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 37
Joined: May 15th, 2006
How to LoadPicFromRes from a dll file?
Jul 27th, 2006 at 6:42am
Print Post  
Hi,
I have a problem again Embarrassed
What I want to do is that: several components are written in a dll, in this dll file include the icons for each component, and then in the outside, we intend to get these icons and set the pictures of boxes by these icons.

And the source code is like this:

HINSTANCE hDll=NULL;
hDll=LoadLibrary("MyDLL.dll");
box.LoadPicFromRes((LONG) hDll,_T("IDR_IMAGES"),_T("IMAGES"));

The MyDLL.dll is the dll file that including the custome resource "IMAGES", and in the "IMAGES" resouce including "IDR_IMAGES1" and "IDR_IMAGES2" items, just like the sample "NetSample" that offered by you.

But the problem is that: the program can be complied correctly, but the picture of the box are blank, that is to say the resource are not load correctly, how can I handle this problem?

Thank you very much!
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3176
Joined: Oct 19th, 2005
Re: How to LoadPicFromRes from a dll file?
Reply #1 - Jul 27th, 2006 at 8:50am
Print Post  
The control does not understand the Image resource format, LoadPicFromRes can load a resource only if it is an exact copy of an image file inserted as a Binary resource.
  
Back to top
 
IP Logged
 
Joanna
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 37
Joined: May 15th, 2006
Re: How to LoadPicFromRes from a dll file?
Reply #2 - Jul 27th, 2006 at 10:22pm
Print Post  
Yes, I understand what you sad, and what I have done is just like what you said, the IDR_IMAGES1 is inserted in "IMAGES" as a Biary resource, but it still cannot show the picture out.

Then what kind of thing I can do? Do you have some samples that load picture from DLL that including picture resource?

Thank you!
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3176
Joined: Oct 19th, 2005
Re: How to LoadPicFromRes from a dll file?
Reply #3 - Jul 28th, 2006 at 6:22am
Print Post  
Are you sure you have assigned string identifiers to the image resources ? When you open the resource view, it should display the IDs as

"IDR_IMAGE1", "IDR_IMAGE2", etc.

and not

IDR_IMAGE1, IDR_IMAGE2, etc.

If using integer IDs, the MAKEINTRESOURCE macro will help you convert from integer to string identifiers.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint