我找了帮助,仔细看看。用new创建的对象,是分配在heap中的,必须delete;用create()创建的 是分配在stack中的,绘自动销毁。 If you create a CEdit object within a dialog box, the CEdit object is automatically destroyed when the user closes the dialog box.If you create a CEdit object from a dialog resource using the dialog editor, the CEdit object is automatically destroyed when the user closes the dialog box.If you create a CEdit object within a window, you may also need to destroy it. If you create the CEdit object on the stack, it is destroyed automatically. If you create the CEdit object on the heap by using the new function, you must call delete on the object to destroy it when the user terminates the Windows edit control. If you allocate any memory in the CEdit object, override the CEdit destructor to dispose of the allocations.
同意huntout兄的看法。
为何这样,就是为了管理,当父窗口
关闭时,会自动释放下属窗口的资源
是分配在stack中的,绘自动销毁。
If you create a CEdit object within a dialog box, the CEdit object is automatically destroyed when the user closes the dialog box.If you create a CEdit object from a dialog resource using the dialog editor, the CEdit object is automatically destroyed when the user closes the dialog box.If you create a CEdit object within a window, you may also need to destroy it. If you create the CEdit object on the stack, it is destroyed automatically. If you create the CEdit object on the heap by using the new function, you must call delete on the object to destroy it when the user terminates the Windows edit control. If you allocate any memory in the CEdit object, override the CEdit destructor to dispose of the allocations.
问题解决了,30分就平分一下吧!下次多给点了,不多了!呵呵