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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Custom Controls in MFC

Custom Controls in MFC

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpsalesquestionlearning
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.
  • P Offline
    P Offline
    Paul Groetzner
    wrote on last edited by
    #1

    Hello all, I am trying to create a custom control but I have a major problem I haven't been able to resolve. The issue is this: If I introduce a customer control using the resource editor to a new or an existing dialog box, that specific dialog will cease to appear when the program is run (or the app won't run if it happens to be within the main dialog box). If I delete the control, everything works fine again and the dialog box will once again appear. Could someone please assist? This has been puzzling me for quite some time. I'm using VC++ 2005. To replicate, create a new dialog based application. Run it to see the default dialog box appear, then exit. Drag a custom control from the toolbox into the main dialog box. Run it again. If you can get the dialog box to appear even if the control doesn't do anything yet, let me know what you did! Thanks!!!!!

    C D L 3 Replies Last reply
    0
    • P Paul Groetzner

      Hello all, I am trying to create a custom control but I have a major problem I haven't been able to resolve. The issue is this: If I introduce a customer control using the resource editor to a new or an existing dialog box, that specific dialog will cease to appear when the program is run (or the app won't run if it happens to be within the main dialog box). If I delete the control, everything works fine again and the dialog box will once again appear. Could someone please assist? This has been puzzling me for quite some time. I'm using VC++ 2005. To replicate, create a new dialog based application. Run it to see the default dialog box appear, then exit. Drag a custom control from the toolbox into the main dialog box. Run it again. If you can get the dialog box to appear even if the control doesn't do anything yet, let me know what you did! Thanks!!!!!

      C Offline
      C Offline
      Cedric Moonen
      wrote on last edited by
      #2

      You have to provide a window class name that has been registered (through AfxRegisterClass function). Take a look at this article[^] for an example. If you don't follow this step, there won't be any window procedure associated with the control and the creation of the dialog will fail.


      Cédric Moonen Software developer
      Charting control

      1 Reply Last reply
      0
      • P Paul Groetzner

        Hello all, I am trying to create a custom control but I have a major problem I haven't been able to resolve. The issue is this: If I introduce a customer control using the resource editor to a new or an existing dialog box, that specific dialog will cease to appear when the program is run (or the app won't run if it happens to be within the main dialog box). If I delete the control, everything works fine again and the dialog box will once again appear. Could someone please assist? This has been puzzling me for quite some time. I'm using VC++ 2005. To replicate, create a new dialog based application. Run it to see the default dialog box appear, then exit. Drag a custom control from the toolbox into the main dialog box. Run it again. If you can get the dialog box to appear even if the control doesn't do anything yet, let me know what you did! Thanks!!!!!

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

        Can you add the DS_NOFAILCREATE style (until you resolve the problem)? Do you get any output in the debug window (e.g, failed to load xyz.dll)?


        "The largest fire starts but with the smallest spark." - David Crow

        1 Reply Last reply
        0
        • P Paul Groetzner

          Hello all, I am trying to create a custom control but I have a major problem I haven't been able to resolve. The issue is this: If I introduce a customer control using the resource editor to a new or an existing dialog box, that specific dialog will cease to appear when the program is run (or the app won't run if it happens to be within the main dialog box). If I delete the control, everything works fine again and the dialog box will once again appear. Could someone please assist? This has been puzzling me for quite some time. I'm using VC++ 2005. To replicate, create a new dialog based application. Run it to see the default dialog box appear, then exit. Drag a custom control from the toolbox into the main dialog box. Run it again. If you can get the dialog box to appear even if the control doesn't do anything yet, let me know what you did! Thanks!!!!!

          L Offline
          L Offline
          Laxman Auti
          wrote on last edited by
          #4

          Hey i have faced the same problem and got the solution over this.

          univega_r304 wrote:

          If I delete the control, everything works fine again and the dialog box will once again appear.

          Call the Following Method to enable the custom containers in the application where you are using the custom controls

          AfxEnableControlContainer();

          Knock out 't' from can't, You can if you think you can :cool:

          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