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. how to create a self contained dialog that can be used in mutiple applications?

how to create a self contained dialog that can be used in mutiple applications?

Scheduled Pinned Locked Moved C / C++ / MFC
helplearningc++tutorialquestion
4 Posts 4 Posters 0 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.
  • L Offline
    L Offline
    largeinsd
    wrote on last edited by
    #1

    hi, i am learning mfc, and having a good time doing so. i currently stuck on how to approach a particular problem: i am trying to create a control a color picker control that has four parts for self contained use in multiple projects. the four (rather simple, i know...) parts are: 1) a static box for showing the color selected 2) three separate spin controls that allow you to select the R,G, B components of the color i know that there are several color pickers avail that do this, but i would like to create my own for use in my own projects, partly as an exercise in how to create self contained controls. problems that i am having: 1) it is my understanding that there is no way to save a dialog as a resource by itself... the resource file is for the whole project. no importing/exporting of individual dialog resources. 2) so that's ok - i will just create a dialog class and include all of the elements that i want as memebers therein and init them in the dialog class in OnInitDialog using their individual ::Create() methods. uh, but wait a minute... when it comes time to listening for events, don't i have to give a resource ID for the call to DDX_Control(, , )... ? Uh, I seem to be chasing my tail here... Any help appreciated. - @LRG

    D B M 3 Replies Last reply
    0
    • L largeinsd

      hi, i am learning mfc, and having a good time doing so. i currently stuck on how to approach a particular problem: i am trying to create a control a color picker control that has four parts for self contained use in multiple projects. the four (rather simple, i know...) parts are: 1) a static box for showing the color selected 2) three separate spin controls that allow you to select the R,G, B components of the color i know that there are several color pickers avail that do this, but i would like to create my own for use in my own projects, partly as an exercise in how to create self contained controls. problems that i am having: 1) it is my understanding that there is no way to save a dialog as a resource by itself... the resource file is for the whole project. no importing/exporting of individual dialog resources. 2) so that's ok - i will just create a dialog class and include all of the elements that i want as memebers therein and init them in the dialog class in OnInitDialog using their individual ::Create() methods. uh, but wait a minute... when it comes time to listening for events, don't i have to give a resource ID for the call to DDX_Control(, , )... ? Uh, I seem to be chasing my tail here... Any help appreciated. - @LRG

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Another option would be to save the dialog template in a separate file that could then be #included in either the .rc or .rc2 file.

      "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

      "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

      1 Reply Last reply
      0
      • L largeinsd

        hi, i am learning mfc, and having a good time doing so. i currently stuck on how to approach a particular problem: i am trying to create a control a color picker control that has four parts for self contained use in multiple projects. the four (rather simple, i know...) parts are: 1) a static box for showing the color selected 2) three separate spin controls that allow you to select the R,G, B components of the color i know that there are several color pickers avail that do this, but i would like to create my own for use in my own projects, partly as an exercise in how to create self contained controls. problems that i am having: 1) it is my understanding that there is no way to save a dialog as a resource by itself... the resource file is for the whole project. no importing/exporting of individual dialog resources. 2) so that's ok - i will just create a dialog class and include all of the elements that i want as memebers therein and init them in the dialog class in OnInitDialog using their individual ::Create() methods. uh, but wait a minute... when it comes time to listening for events, don't i have to give a resource ID for the call to DDX_Control(, , )... ? Uh, I seem to be chasing my tail here... Any help appreciated. - @LRG

        B Offline
        B Offline
        Bram van Kampen
        wrote on last edited by
        #3

        I suggest that you build a DLL which gives access to, or maybe exports your dialog. You need to export it if you want to be able to derrive from your dialog. The main difficulty in this case is the selection of a resource ID that's not going to be used in any of the apps that use your DLL. Regards,

        Bram van Kampen

        1 Reply Last reply
        0
        • L largeinsd

          hi, i am learning mfc, and having a good time doing so. i currently stuck on how to approach a particular problem: i am trying to create a control a color picker control that has four parts for self contained use in multiple projects. the four (rather simple, i know...) parts are: 1) a static box for showing the color selected 2) three separate spin controls that allow you to select the R,G, B components of the color i know that there are several color pickers avail that do this, but i would like to create my own for use in my own projects, partly as an exercise in how to create self contained controls. problems that i am having: 1) it is my understanding that there is no way to save a dialog as a resource by itself... the resource file is for the whole project. no importing/exporting of individual dialog resources. 2) so that's ok - i will just create a dialog class and include all of the elements that i want as memebers therein and init them in the dialog class in OnInitDialog using their individual ::Create() methods. uh, but wait a minute... when it comes time to listening for events, don't i have to give a resource ID for the call to DDX_Control(, , )... ? Uh, I seem to be chasing my tail here... Any help appreciated. - @LRG

          M Offline
          M Offline
          Mark Salsbery
          wrote on last edited by
          #4

          In addition to the other replies... Whatever method you choose - resource-only DLL, resource includes, etc., the most important thing is to manage IDs so they don't clash. For example, I personally have a solution with several EXEs that share an MFC extension DLL, and also share common code that is compiled/linked directly into several EXEs. From the start, I set aside blocks of resource IDs for each - one block for the shared DLL, one for common code, and one for EXEs. For new projects, I just have to adjust the _APS_NEXT_xxx values in the resource.h file so the Visual Studio auto-generated IDs start in the proper range of IDs. The info in these technical notes explains the details... TN020: ID Naming and Numbering Conventions[^] TN035: Using Multiple Resource Files and Header Files with Visual C++[^] Mark

          Mark Salsbery Microsoft MVP - Visual C++ :java:

          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