1
votes

I am working on a MFC SDI application. I want to get a dialog box called on the click of a menu button but I want to create that dialog box dynamically and not use the resource view. I am not able to figure out how to do that even after googling a lot.

2

2 Answers

1
votes
  • Create an empty dialog resource or use a empty resource template in memory.
  • Create the dialog. Either using a pointer to the resource template in memory, or in the resource.
  • Call DoModal.
  • In OnInitDialog. Resize the dialog, Create all child windows, set the dialog title...
0
votes

Back around Visual Studio 2008, there was some sample code called DLGTEMPL. I've used it to build a dynamic dialog just like you want. I'm using VS2013 and I could not seem to find the sample code on my local hard drive. However, Microsoft still makes this available here via a VS2005 samples page. Simply click on "Download Sample" at the top and it will install the sample onto your hard drive. The sample provides the basis for creating a dynamic dialog from an in memory resource.