Combining Resources

This is a discussion on Combining Resources within the Windows Programming forums, part of the Platform Specific Boards category; I am new to programming with the windows API, and I figured that what I want to do is possible, ...

  1. #1
    Registered User
    Join Date
    Dec 2009
    Posts
    2

    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!

  2. #2
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,859
    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.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  3. #3
    Registered User
    Join Date
    Dec 2009
    Posts
    2
    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?

  4. #4
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,859
    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).
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Sharing resources between game states
    By Memloop in forum Game Programming
    Replies: 1
    Last Post: 12-01-2009, 08:48 AM
  2. measuring system resources used by a function
    By Aran in forum C Programming
    Replies: 1
    Last Post: 03-13-2006, 04:35 PM
  3. Storing resources into a single file
    By LuckY in forum Game Programming
    Replies: 20
    Last Post: 08-14-2004, 11:28 PM
  4. Adding resources
    By nima_ranjbar in forum Windows Programming
    Replies: 0
    Last Post: 04-14-2002, 11:36 PM
  5. Dialogs and resources
    By SushiFugu in forum Windows Programming
    Replies: 6
    Last Post: 01-23-2002, 01:05 PM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21