在一个对话框中加入一个ActiveX控件MSCal.ocx,
为了改变控件中的日期值,
在对话框中定义一个变量COleVariant m_varValue;
但是编译到这里的时候出现错误4个错误error C2146: syntax error : missing ';' before identifier 'm_varValue'
error C2501: 'COleVaraint' : missing storage-class or type specifiers
error C2501: 'm_varValue' : missing storage-class or type specifiers
error C2065: 'm_varValue' : undeclared identifier不知道为什么出现这错误,
工程创建的时候ActiveX的支持已经打勾,
stdafx.h里面也有 #include <afxdisp.h>        // MFC Automation classes
这个只是《Visual C++ 6.0 技术内幕》书中第八章的一个例子,
对话框部分的头文件代码如下,求助#if !defined(AFX_ACTIVEXDIALOG_H__14D8BC3A_5FF1_47D7_931A_849BE9FDEED7__INCLUDED_)
#define AFX_ACTIVEXDIALOG_H__14D8BC3A_5FF1_47D7_931A_849BE9FDEED7__INCLUDED_#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// ActiveXDialog.h : header file
///////////////////////////////////////////////////////////////////////////////
// CActiveXDialog dialog#include "calendar.h"class CActiveXDialog : public CDialog
{
// Construction
public:
CActiveXDialog(CWnd* pParent = NULL);   // standard constructor// Dialog Data
//{{AFX_DATA(CActiveXDialog)
enum { IDD = IDD_ACTIVEXDIALOG };
// NOTE: the ClassWizard will add data members here
CCalendar   m_calendar;
short       m_sDay;
short       m_sMonth;
short       m_sYear;
//}}AFX_DATA
COleVaraint   m_varValue;          //这行出错
unsigned long m_BackColor;
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CActiveXDialog)
protected:
virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
//}}AFX_VIRTUAL// Implementation
protected: // Generated message map functions
//{{AFX_MSG(CActiveXDialog)
virtual BOOL OnInitDialog();
afx_msg void OnNewMonthCalendar1();
afx_msg void OnSelectdate();
afx_msg void OnNextweek();
virtual void OnOK();
DECLARE_EVENTSINK_MAP()
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.#endif // !defined(AFX_ACTIVEXDIALOG_H__14D8BC3A_5FF1_47D7_931A_849BE9FDEED7__INCLUDED_)