Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Conflicting Resource IDs

Conflicting Resource IDs

Scheduled Pinned Locked Moved C / C++ / MFC
questionlearning
5 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    softwaremonkey
    wrote on last edited by
    #1

    Hi, I am linking my app with a number of static libraries which contain dialog resources etc. Unfortuntately, some of the resource IDs appear to be conflicting. I could reallocate the resource IDs in the static libs to overcome this but is there a better way? Thanks Tony

    H 1 Reply Last reply
    0
    • S softwaremonkey

      Hi, I am linking my app with a number of static libraries which contain dialog resources etc. Unfortuntately, some of the resource IDs appear to be conflicting. I could reallocate the resource IDs in the static libs to overcome this but is there a better way? Thanks Tony

      H Offline
      H Offline
      Hans Dietrich
      wrote on last edited by
      #2

      The only IDs that must be unique are dialog IDDs, string IDSs, and menu IDs. The IDCs can be reused (between dialogs) and it won't matter. To ensure that the dialog IDDs don't collide, you could switch to string resource names, instead of numeric resource IDs. To do this, simply comment out the IDD define in resource.h, and change the ctor of the dialog to use the string form. Also comment out the enum in the dialog header file. Ideally, the resource.h file should be organized by dialog, so that each IDC is unique; sometimes this can get away from you. You might want to check into the excellent Resource ID Organiser Add-In for Visual C++ 5.0/6.0/.NET[^] as a way of restoring order to resource.h.

      Best wishes, Hans


      [Hans Dietrich Software]

      S 2 Replies Last reply
      0
      • H Hans Dietrich

        The only IDs that must be unique are dialog IDDs, string IDSs, and menu IDs. The IDCs can be reused (between dialogs) and it won't matter. To ensure that the dialog IDDs don't collide, you could switch to string resource names, instead of numeric resource IDs. To do this, simply comment out the IDD define in resource.h, and change the ctor of the dialog to use the string form. Also comment out the enum in the dialog header file. Ideally, the resource.h file should be organized by dialog, so that each IDC is unique; sometimes this can get away from you. You might want to check into the excellent Resource ID Organiser Add-In for Visual C++ 5.0/6.0/.NET[^] as a way of restoring order to resource.h.

        Best wishes, Hans


        [Hans Dietrich Software]

        S Offline
        S Offline
        softwaremonkey
        wrote on last edited by
        #3

        Hi Hans, Thanks for the reply - that's a great idea! Thanks again :thumbsup: :thumbsup: :-D Tony

        1 Reply Last reply
        0
        • H Hans Dietrich

          The only IDs that must be unique are dialog IDDs, string IDSs, and menu IDs. The IDCs can be reused (between dialogs) and it won't matter. To ensure that the dialog IDDs don't collide, you could switch to string resource names, instead of numeric resource IDs. To do this, simply comment out the IDD define in resource.h, and change the ctor of the dialog to use the string form. Also comment out the enum in the dialog header file. Ideally, the resource.h file should be organized by dialog, so that each IDC is unique; sometimes this can get away from you. You might want to check into the excellent Resource ID Organiser Add-In for Visual C++ 5.0/6.0/.NET[^] as a way of restoring order to resource.h.

          Best wishes, Hans


          [Hans Dietrich Software]

          S Offline
          S Offline
          softwaremonkey
          wrote on last edited by
          #4

          Hans, Sorry to trouble you again but I have changed the dialogs to use string resources and recompiled both the lib and the application which uses the lib. Everthing compiled OK but the dialog does not appear when DoModal() is called. I have trace through the MFC code for DoModal() and the call to FindResource() returns NULL, even though the resource name is correct. If I compile the library as a DLL then the dialog appears OK. I realise its hard to do things by remote control but do you have any thoughts as to what could be causing this problem, or what I could check? :confused: Thanks Tony

          H 1 Reply Last reply
          0
          • S softwaremonkey

            Hans, Sorry to trouble you again but I have changed the dialogs to use string resources and recompiled both the lib and the application which uses the lib. Everthing compiled OK but the dialog does not appear when DoModal() is called. I have trace through the MFC code for DoModal() and the call to FindResource() returns NULL, even though the resource name is correct. If I compile the library as a DLL then the dialog appears OK. I realise its hard to do things by remote control but do you have any thoughts as to what could be causing this problem, or what I could check? :confused: Thanks Tony

            H Offline
            H Offline
            Hans Dietrich
            wrote on last edited by
            #5

            In your original message you said "I am linking my app with a number of static libraries which contain dialog resources". This is not possible. A static lib cannot have resources. A DLL (really an exe) can contain resources.

            Best wishes, Hans


            [Hans Dietrich Software]

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups