第一次使用这个类,我把他当作EditBox的Value
没有添加任何代码,
通过了编译,但不能运行,
单步执行,每次运行到
CDddDlg::CDddDlg(CWnd* pParent /*=NULL*/)
: CDialog(CDddDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CDddDlg)
m_aaa = COleDateTime::GetCurrentTime(); // 这里就报错啊!!。
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}是什么原因呢?
没有添加任何代码,
通过了编译,但不能运行,
单步执行,每次运行到
CDddDlg::CDddDlg(CWnd* pParent /*=NULL*/)
: CDialog(CDddDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CDddDlg)
m_aaa = COleDateTime::GetCurrentTime(); // 这里就报错啊!!。
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}是什么原因呢?
// 初始化 OLE 库
if (!AfxOleInit())
{
AfxMessageBox(IDP_OLE_INIT_FAILED);
return FALSE;
}
其他什么代码也没加,
我加上去看看
{
AfxEnableControlContainer();
#ifdef _AFXDLL
Enable3dControls();
#else
Enable3dControlsStatic();
#endif
// 初始化 OLE 库
if (!AfxOleInit()) // 这里就报错了!!
{
AfxMessageBox("aaa");
return FALSE;
}
CDddDlg dlg;
m_pMainWnd = &dlg;
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
}
else if (nResponse == IDCANCEL)
{
}
return FALSE;
}还是报错啊,这次在
if (!AfxOleInit())
就报错了,不过编译通过了,还是不能运行
不知道你是怎么生成的框架。
不过我现在用的是VC.net,可能有点不同。
你其实可以用CTime的啊。
我就是这样用的。
你帮我试试好了,建个对话框,里面放个EditBox
在上面用ClassWizard绑定一个ColeDateTime类型的变量
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
, m_wndTime(COleDateTime::GetCurrentTime())
[email protected]
地址是:seumasai.myetang.com/download/ddd.zip
[email protected]
CDddDlg::CDddDlg(CWnd* pParent /*=NULL*/)
: CDialog(CDddDlg::IDD, pParent),
m_aaa(COleDateTime::GetCurrentTime())
{
//{{AFX_DATA_INIT(CDddDlg)
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
呵呵,不会是你定义的m_aaa的类型不是COleDateTime吧!?