Click here to Skip to main content
15,886,055 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I write a customized win32 control which need serval icon resources. I want to reuse this control for some other projects.

The control have a header file which including the definition of the control's structure like this:

C++
typedef struct __control_my_customized__ {
    //...
    HIMAGELIST icon_list;
    //...
} RCustCtrl,*pCustCtrl;


Together there is a .c file which including the initialization of the control resource and the handle of win32 messages.

Also there would be a .rc file which including the icon files referred in the HIMAGELIST as before.

So the composition of the control's source code would be several parts like this:
1. custctrl.h: definition of the control's structure.
2. custctrl.c
3. custctrl.rc: definition of the resources referred in the control
4. icon files.

Now with MSVC, if I want to wrap the control , for example , a lib file or a dll file, there would be some complier commands like this:
1. rc custctrl.rc
generate the .res file
2. cl -c custctrl.c
generate the .obj file
3. lib custctrl.obj /link custctrl.res
generate the lib file

That's all OK. Right Now I need to use this control in some projects.
I think I only need custctrl.h/custctrl.lib, however, I need copy the resource files together and regenerate the .res file.

That's not what I want.

What I have tried:

I do not want to expose the resource (the icon files) to the users.
So how should I wrap the control ?
Posted
Updated 4-Oct-22 1:14am

1 solution

You can add resources into a .dll file, see Creating a resource-only DLL | Microsoft Learn[^].
 
Share this answer
 
Comments
CPallini 4-Oct-22 7:39am    
Indeed.
5.
Richard MacCutchan 4-Oct-22 7:54am    
Thanks, still following me then :))
CPallini 4-Oct-22 8:09am    
As usual... :-)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900