-
Combining Resources
I am new to programming with the windows API, and I figured that what I want to do is possible, but I didn't even know what to search for to find out more about it.
More specifically, I am programming for Windows Mobile 6.5. I have created my own open file dialog because the one that is provided by the API is useless. Now I want to take the open file dialog and all of its functionality, and drop it into another project. The problem is that when I drop my resource files into another project, I get conflicting ID numbers. For example:
Code:
#define IDS_MENU 102
appears in my project, and
Code:
#define IDC_BROWSE 102
is a resource in the dialog that I am bringing in.
Short of going through and manually reassigning numbers, is there any way that I can drop this dialog into my new project and not have any conflicts? I want to just add the resource files to the project, and add:
Code:
case IDM_MENU_OPEN:
myOpenFileDialog();
break;
to my command handler and be done. Is that possible?
Thanks in advance for any suggestions!
-
Different windows can have controls with the same resource ID numbers.
For resources I create I use IDs greater than 40,000 to avoid conflicts with the IDE.
Easiest way is to edit the resource.h file and ressign the conflicting IDs.
-
Thanks for the reply novacain. I didn't know that controls could share a resource ID number as long as they were in different windows. Does that mean that if I create a separate .rc file that contains the dialogs that I want to use in multiple apps, I should just be able to drop it in and go?
-
Depends on your IDE, but usually you can have multiple .rc files.
You also have to include the resource.h (or add the ID defines to the project somewhere).