就是作多个基于对话框的程序,其中都用到一个相同的对话框,上有一个CCheckList的列表框,和两个按钮。用户点击此对话框中的控件做一些操作,程序使用类中变量和函数的形式把值传出来。想做一个类,其中创建了这个对话框和这些控件例如使用AfxRegisterWndClass和CreateEx等。然后加入不同的project中,在classview中就有这个类了,然后创建这个类的实例,在调用它的函数,完成用户交互,在把结果传出来。这样做不同project时用到这个对话框时不用都要单独的用insert dialog加入类中了,直接把这个类*.h和*.cpp加入项目就可以用了,提高一下效率。不知道我说清了没?大家有没有现成的实例程序发一份我看看。谢谢了!我的邮件:[email protected]或者[email protected]

解决方案 »

  1.   

    我想了想,是否可以这样,先建个基于CWnd的类,然后在后造函数中用 AfxRegisterWndClass建个窗口在定义几个控件的类和窗口绑定在加入函数进行交互,用show显示窗口。再把这个类的.h.cpp加入新建的项目,使用时建个类的实例在调用其中的函数交互和显示。
      

  2.   

    use Gallery
    1.first right click the source class and choose "add to gallery" in the popup menu.
    2. in the destination project, choose menu project->add to project->components& controls....
    but you'll have to synchronize the 2 copies of the class.
      

  3.   

    solution 2:
    maybe u can create a independent resource file only for this dialog and every all projects can share 1 copy of the class and  dialog template.