我在.h中定义了字定义消息 const WM_DISPLAY=WM_USER + 100;编译出错:'WM_USER' : undeclared identifier,这是怎么回事? #define WM_DISPLAY WM_USER + 100试一下吧 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 to michaelrunsonc():换成#define WM_DISPLAY WM_USER + 100后,现在变成了这个错:d:\..\.h(19) : error C2504: 'CDialog' : base class undefined下面是整个.h#if !defined(AFX_SHOWINFO_H__A14D0F26_0F5F_11D6_8339_00E04C501B07__INCLUDED_)#define AFX_SHOWINFO_H__A14D0F26_0F5F_11D6_8339_00E04C501B07__INCLUDED_#if _MSC_VER > 1000#pragma once#endif // _MSC_VER > 1000// ShowInfo.h : header file///////////////////////////////////////////////////////////////////////////////// CShowInfo dialogconst WM_DISPLAY=WM_USER + 100;//#define WM_DISPLAY WM_USER + 100;class CShowInfo : public CDialog{// Constructionpublic: CShowInfo(CWnd* pParent = NULL); // standard constructor// Dialog Data //{{AFX_DATA(CShowInfo) enum { IDD = IDD_SHOWINFODLG }; // NOTE: the ClassWizard will add data members here //}}AFX_DATA// Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CShowInfo) protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support //}}AFX_VIRTUAL// Implementationprotected: // Generated message map functions //{{AFX_MSG(CShowInfo) // NOTE: the ClassWizard will add member functions here //}}AFX_MSG DECLARE_MESSAGE_MAP()};//{{AFX_INSERT_LOCATION}}// Microsoft Visual C++ will insert additional declarations immediately before the previous line.#endif // !defined(AFX_SHOWINFO_H__A14D0F26_0F5F_11D6_8339_00E04C501B07__INCLUDED_) 你肯定是windows.h没挂进去检查一下有没有include “stdafx.h"吧 最好是用: #define WM_DISPLAY (WM_USER + 100) 肯定是stdafx.h的毛病,选择build菜单,然后clean,然后重新build,就可以了。define后没有分号 我有另外一个cpp包含了这个.h 但那个cpp没有包含StdAfx.h,我现在在那个cpp中把StdAfx.h包含进去了,好是好了,但是why? WM_USER在windows.h中定义而windows.h在stdafx.h中include你不include stdafx.h当然是WM——USE没定义了 vc编辑框日文显示乱码 大家注意了~,checked_iterator影响performance CHeaderCtrl IP Address控件怎样显示CString变量啊? visual studio 2005 问题 请问如何查msdn ?? 有没有高手??? 好书推荐,荐者加分 怎样做OUTLOOK插件? 三年笔友,三周年纪念,该给什么礼物? (又一次,真的没人回答?)Windows命名空间的系统事件 一个VC地小问题
换成#define WM_DISPLAY WM_USER + 100
后,现在变成了这个错:
d:\..\.h(19) : error C2504: 'CDialog' : base class undefined
下面是整个.h
#if !defined(AFX_SHOWINFO_H__A14D0F26_0F5F_11D6_8339_00E04C501B07__INCLUDED_)
#define AFX_SHOWINFO_H__A14D0F26_0F5F_11D6_8339_00E04C501B07__INCLUDED_#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// ShowInfo.h : header file
///////////////////////////////////////////////////////////////////////////////
// CShowInfo dialogconst WM_DISPLAY=WM_USER + 100;//#define WM_DISPLAY WM_USER + 100;
class CShowInfo : public CDialog
{
// Construction
public:
CShowInfo(CWnd* pParent = NULL); // standard constructor// Dialog Data
//{{AFX_DATA(CShowInfo)
enum { IDD = IDD_SHOWINFODLG };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CShowInfo)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL// Implementation
protected: // Generated message map functions
//{{AFX_MSG(CShowInfo)
// NOTE: the ClassWizard will add member functions here
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.#endif // !defined(AFX_SHOWINFO_H__A14D0F26_0F5F_11D6_8339_00E04C501B07__INCLUDED_)
检查一下有没有include “stdafx.h"吧
#define WM_DISPLAY (WM_USER + 100)
define后没有分号
StdAfx.h包含进去了,好是好了,但是why?
而windows.h在stdafx.h中include
你不include stdafx.h当然是WM——USE没定义了