CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    May 1999
    Location
    Mora,Sweden
    Posts
    38

    Creating a dialog at runtime

    I'm trying to create a dialog at runtime. I have used the DLGTMPL sample as a start. I have gotten it to work with the standard controls, like editcontrol, static text and buttons! But I having trouble with nonstandard control like the DateTimePick control. The reason is of cause that I don't understand what MS is doing in the DemoIt function (that's where they create the dialog and run it)

    Are there some easiar way of doing this then what MS has done?

    If not how do you create a non-standard control at runtime?

    // Anders


  2. #2
    Join Date
    May 1999
    Posts
    30

    Re: Creating a dialog at runtime

    wrer did you get the example from? url? MSDN?


  3. #3
    Join Date
    May 1999
    Location
    Mora,Sweden
    Posts
    38

    Re: Creating a dialog at runtime

    Hello! Yes the example is on the MSDN Library CD that accompanies Visual Studion 6 (I've got the enterprise version)

    It's to much code to include here(?) but it should be available on the msdn web

    Thank you for the reply! It's always nice when people care!

    // Anders


  4. #4
    Join Date
    May 1999
    Posts
    30

    Re: Creating a dialog at runtime

    After looking at the example and reading through the docs - looking at MFC's source code OCCMGR.CPP it's a little more complicated than simply supplying some data. The reason I asked was in my current project we have to write a class for doing this exact thing. It's a little difficult if your a novice the code within the example is pretty striagh forward. But quite useless. I suggest looking through the OCCmgr.cpp source... I'll probably post the source for the class here at codeguru.


  5. #5
    Join Date
    May 1999
    Location
    Oregon, USA
    Posts
    302

    Re: Creating a dialog at runtime

    In my company's app we do something similar to this. Actually, we read real-live
    .RC files and generate dialogs 'on-the-fly'. We do this using the dialog template
    in memory method as shown in the DLGTMPL sample. What we do that is a
    bit different though is we create only the dialog frame in the template. We
    create all of the controls in the OnInitDialog method of a dialog-driving class
    the we made. This is done using the Create members of the various control
    classes. So, we make an object for each control and create them when the
    dialog is created.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured