回答(3)
huigezrx 19级 2014-09-19 21:32:33
通过new运算符构造的CATDlgNotify类实例不要使用delete销毁,而是使用RequestDelayedDestruction,如下面所示:
if(_pDlgNotify != NULL){ _pDlgNotify->RequestDelayedDestruction(); _pDlgNotify = NULL; }
RequestDelayedDestruction是CATCommand类的成员函数,所有CATCommand类及其子类(包括CATDlgNotify)都使用RequestDelayedDestruction方法销毁。
CATDlgNotify类的继承关系如下:
System.CATCommand
--Dialog.CATDialog
----Dialog.CATDlgWindow
------CATDlgNotify
huigezrx 19级 2014-09-19 21:25:09
下面一句是CATDlgNotify类实例化的示例代码:
_pDlgNotify = new CATDlgNotify( CATApplicationFrame::GetFrame()->GetMainWindow(), "PopTipDlg")
将当前环境的主窗口作为提示对话框的父窗口,弹出对话框的内部名字是“PopTipDlg”
huigezrx 19级 2014-09-19 21:06:13
可以在类中声明一个CATDlgNotify类型的成员变量,并初始化,在需要显示提示对话框的地方直接调用CATDlgNotify类的成员方法DisplayBlocked,该方法的声明和帮助说明如下:
o DisplayBlocked
public int DisplayBlocked(const CATUnicodeString& iMessage, const CATUnicodeString& iWndTitle)
Runs the dialog window in a modal loop. Parameters:iMessagethe message displayed by the window. iWndTitlethe title of the window. Returns:an integer identifying the button which has been pressed.Legal values:1The OK button has been pressed. 2The Cancel button has been pressed. 3The Yes button has been pressed. 4The No button has been pressed. 5The Retry button has been pressed. 6The Abort button has been pressed. 7The Ignore button has been pressed.