msg test
c++吧
全部回复
仅看楼主
level 1

class CMsgTestDoc : public CDocument
{
protected: // 仅从序列化创建
CMsgTestDoc();
DECLARE_DYNCREATE(CMsgTestDoc)
// 属性
public:
// 操作
public:
// 重写
public:virtual BOOL OnNewDocument();
virtual void Serialize(CArchive& ar);
// 实现
public:
virtual ~CMsgTestDoc();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// 生成的消息映射函数
protected:
DECLARE_MESSAGE_MAP()
private:
// 鼠标光标的 x 坐标
int m_PosX;
// 鼠标光标的 y 坐标
int m_PosY;
// 窗口的高度
int m_Height;
// 窗口长度
int m_Width;
public:
void SetPosX(int x);
void SetPosY(int y);
void SetHeight(int h);
void SetWidth(int w);
};
===============================================================================
// CMsgTestDoc 命令
void CMsgTestDoc::SetPosX(int x)
{
m_PosX = x;
UpdateAllViews(NULL);
}
void CMsgTestDoc::SetPosY(int y)
{
m_PosY = y;
UpdateAllViews(NULL);
}
void CMsgTestDoc::SetHeight(int h)
{
m_Height = h;UpdateAllViews(NULL);
}
void CMsgTestDoc::SetWidth(int w)
{
m_Width = w;UpdateAllViews(NULL);
}
int CMsgTestDoc::GetPosX(void)
{
return m_PosX;
}
int CMsgTestDoc::GetPosY(void)
{
return m_PosY;
}
int CMsgTestDoc::GetHeight(void)
{
return m_Height;
}
int CMsgTestDoc::GetWidht(void)
{return m_Width;
}
==========================================
有错误 求解
红点那里是 出错的 地方

2012年02月25日 09点02分 1
level 8
MFC?
不懂
2012年02月25日 09点02分 2
level 1
是 mfc
2012年02月25日 09点02分 3
level 1
pDC都被注释掉了还能用?
2012年02月25日 12点02分 4
level 11
正解
2012年02月25日 13点02分 5
level 1
注释 那一块是 翻译过来的
不知道 对不对 ,
其他地方 , 因该还有错误地 ,就是初次接触 不是很懂 所以求解
2012年02月25日 13点02分 6
level 1
// CMsgTestDoc 命令
void CMsgTestDoc::SetPosX(int x)
{
m_PosX = x;UpdateAllViews(NULL);
}
void CMsgTestDoc::SetPosY(int y)
{
m_PosY = y;UpdateAllViews(NULL);
}
void CMsgTestDoc::SetHeight(int h)
{m_Height = h;UpdateAllViews(NULL);
}
void CMsgTestDoc::SetWidht(int w)
{
m_Width =w;UpdateAllViews(NULL);
}
intCMsgTestDoc::GetPosX(void)
{
return m_PosX;
}
===================================================================
错误内容
msgtestdoc.cpp(172):error C2653: “intCMsgTestDoc”: 不是类或命名空间名称
msgtestdoc.cpp(173):error C4430: 缺少类型说明符-假定为 int。注意: C++不支持默认
int msgtestdoc.cpp(174): error C2065: “m_PosX”: 未声明的标识符

2012年02月26日 01点02分 7
level 1
哪里,该怎么弄才好呢
2012年02月26日 01点02分 9
level 1
能帮我写下马 ,
2012年02月26日 02点02分 11
level 1
msgtestdoc.cpp(171): error C2039: “GetPosX”: 不是“CMsgTestDoc”的成员
msgtestdoc.h(9) : 参见“CMsgTestDoc”的声明 msgtestdoc.cpp(173): error C2065: “m_PosX”: 未声明的标识符
2012年02月26日 03点02分 12
1