error C2065: “spath”: 未声明的标识符等等一堆错误

展开阅读全文

error C2065: “m_pStrategyDlg”: 未声明标识符

10-28

新手请教个问题,网上查了半天也没找到原因。rnTESTStrategy.h里定义一个对话框的(TestItpDialog* m_pStrategyDlg;),但在TESTStrategy.cpp里面Strategy_CreatWindow函数使用该变量时总是提示“error C2065: “m_pStrategyDlg”: 未声明的标识符”。rnTESTSTRATEGY.H代码:rn#pragma oncern#include "strategybase.h"rn#include "list"rn#include rn#include "map"rn#include "TestItpDialog.h"//TestItpDialog 类的头文件rnrnusing std::vector;rnusing std::list;rnusing std::map;rnrnconst int MAX_BAR_SIZE = 1000;rnrnclass TestStrategy :rnpublic CStrategyBasernrnpublic:rnTestStrategy(void);rn~TestStrategy(void);rnrnvirtual int Strategy_OnStart(IiTPInterface* piTP);rnvirtual int Strategy_OnStop(IiTPInterface* piTP);rnvirtual int Strategy_CreatWindow(HWND hWnd,HWND hWndParent);rnvirtual int Strategy_DestroyWindow(HWND hWnd);rnrnprivate:rnrnTestItpDialog* m_pStrategyDlg; // 策略窗口rnrn;rnrnTESTStrategy.cpp里rnint Strategy_CreatWindow(HWND hWnd,HWND hWndParent)rnrn// 创建策略窗口rnAFX_MANAGE_STATE(AfxGetStaticModuleState());rnm_pStrategyDlg = new TestTipDialog;rnif (NULL == m_pStrategyDlg)rnrnASSERT(FALSE);rnreturn -1;rnrnif (!::IsWindow(m_pStrategyDlg->GetSafeHwnd()) && !m_pStrategyDlg->Create(TestItpDialog::IDD))rn rn return -1;rn rnm_pStrategyDlg->ModifyStyleEx(WS_POPUP | WS_BORDER | WS_DLGFRAME,WS_CHILD);rn hWnd = m_pStrategyDlg->GetSafeHwnd();rnreturn 0;rnrnrn 论坛

error C2065: “crFore”: 未声明标识符

06-07

// fuxuandanxuanDlg.cpp : 实现文件rn//rnrn#include "stdafx.h"rn#include "fuxuandanxuan.h"rn#include "fuxuandanxuanDlg.h"rnrn#ifdef _DEBUGrn#define new DEBUG_NEWrn#endifrnrnrn// 用于应用程序“关于”菜单项的 CAboutDlg 对话框rnrnclass CAboutDlg : public CDialogrnrnpublic:rn CAboutDlg();rnrn// 对话框数据rn enum IDD = IDD_ABOUTBOX ;rnrn protected:rn virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持rnrn// 实现rnprotected:rn DECLARE_MESSAGE_MAP()rn;rnrnCAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)rnrnrnrnvoid CAboutDlg::DoDataExchange(CDataExchange* pDX)rnrn CDialog::DoDataExchange(pDX);rnrnrnBEGIN_MESSAGE_MAP(CAboutDlg, CDialog)rnEND_MESSAGE_MAP()rnrnrn// CfuxuandanxuanDlg 对话框rnrnrnrnrnCfuxuandanxuanDlg::CfuxuandanxuanDlg(CWnd* pParent /*=NULL*/)rn : CDialog(CfuxuandanxuanDlg::IDD, pParent)rnrn m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);rnrnrnvoid CfuxuandanxuanDlg::DoDataExchange(CDataExchange* pDX)rnrn CDialog::DoDataExchange(pDX);rn DDX_Control(pDX, IDC_CHK_BLUE, m_chk_blue);rn DDX_Control(pDX, IDC_CHK_GREEN, m_chk_green);rn DDX_Control(pDX, IDC_CHK_RED, m_chk_red);rn DDX_Control(pDX, IDC_RD_RECT, m_rd_rect);rn DDX_Control(pDX, IDC_RD_ROUND, m_rd_round);rnrnrnBEGIN_MESSAGE_MAP(CfuxuandanxuanDlg, CDialog)rn ON_WM_SYSCOMMAND()rn ON_WM_PAINT()rn ON_WM_QUERYDRAGICON()rn //AFX_MSG_MAPrn ON_WM_ERASEBKGND()rn ON_BN_CLICKED(IDC_CHK_BLUE, &CfuxuandanxuanDlg::OnBnClickedChkBlue)rn ON_BN_CLICKED(IDC_CHK_GREEN, &CfuxuandanxuanDlg::OnBnClickedChkGreen)rn ON_BN_CLICKED(IDC_CHK_RED, &CfuxuandanxuanDlg::OnBnClickedChkRed)rn ON_BN_CLICKED(IDC_RD_RECT, &CfuxuandanxuanDlg::OnBnClickedRdRect)rn ON_BN_CLICKED(IDC_RD_ROUND, &CfuxuandanxuanDlg::OnBnClickedRdRound)rnEND_MESSAGE_MAP()rnrnrn// CfuxuandanxuanDlg 消息处理程序rnrnBOOL CfuxuandanxuanDlg::OnInitDialog()rnrn CDialog::OnInitDialog();rnrn // 将“关于...”菜单项添加到系统菜单中。rnrn // IDM_ABOUTBOX 必须在系统命令范围内。rn ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);rn ASSERT(IDM_ABOUTBOX < 0xF000);rnrn CMenu* pSysMenu = GetSystemMenu(FALSE);rn if (pSysMenu != NULL)rn rn CString strAboutMenu;rn strAboutMenu.LoadString(IDS_ABOUTBOX);rn if (!strAboutMenu.IsEmpty())rn rn pSysMenu->AppendMenu(MF_SEPARATOR);rn pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);rn rn rn CheckRadioButton(IDC_RD_RECT,IDC_RD_ROUND,IDC_RD_ROUND);rnrnrn // 设置此对话框的图标。当应用程序主窗口不是对话框时,框架将自动rn // 执行此操作rn SetIcon(m_hIcon, TRUE); // 设置大图标rn SetIcon(m_hIcon, FALSE); // 设置小图标rnrn // TODO: 在此添加额外的初始化代码rnrn return TRUE; // 除非将焦点设置到控件,否则返回 TRUErnrnrnvoid CfuxuandanxuanDlg::OnSysCommand(UINT nID, LPARAM lParam)rnrn if ((nID & 0xFFF0) == IDM_ABOUTBOX)rn rn CAboutDlg dlgAbout;rn dlgAbout.DoModal();rn rn elsern rn CDialog::OnSysCommand(nID, lParam);rn rnrnrn// 如果向对话框添加最小化按钮,则需要下面的代码rn// 来绘制该图标。对于使用文档/视图模型的 MFC 应用程序,rn// 这将由框架自动完成。rnrnvoid CfuxuandanxuanDlg::OnPaint()rnrn if (IsIconic())rn rn CPaintDC dc(this); // 用于绘制的设备上下文rnrn SendMessage(WM_ICONERASEBKGND, reinterpret_cast(dc.GetSafeHdc()), 0);rnrn // 使图标在工作区矩形中居中rn int cxIcon = GetSystemMetrics(SM_CXICON);rn int cyIcon = GetSystemMetrics(SM_CYICON);rn CRect rect;rn GetClientRect(&rect);rn int x = (rect.Width() - cxIcon + 1) / 2;rn int y = (rect.Height() - cyIcon + 1) / 2;rnrn // 绘制图标rn dc.DrawIcon(x, y, m_hIcon);rn rn elsern rn CDialog::OnPaint();rn rnrnrn//当用户拖动最小化窗口时系统调用此函数取得光标rn//显示。rnHCURSOR CfuxuandanxuanDlg::OnQueryDragIcon()rnrn return static_cast(m_hIcon);rnrnrnrnBOOL CfuxuandanxuanDlg::OnEraseBkgnd(CDC* pDC)rnrn //先绘制默认背景rn BOOL bRet=CDialog::OnEraseBkgnd(pDC);rn //获取复选框控件所选的颜色rn int nRed,nGreen,nBlue;rn rn nRed=m_chk_red.GetCheck()?255:0;rn nGreen=m_chk_green.GetCheck()?255:0;rn nBlue=m_chk_blue.GetCheck()?255:0;rn//根据选择组成颜色rn COLORREF crFrore=RGB(nRed,nGreen,nBlue);rn //创建制定颜色的画刷rn CBrush brush;rn brush.CreateSolidBrush(crFore);rn //将画刷入DCrn CBrush *pOldBrush = pDC->SelectObject(&brush);rn //根据选择,绘制矩形或圆形rn RECT rc =50,20,150,120;rn if (m_rd_rect.GetCheck())rn pDC->Rectangle(&rc);rn elsern pDC->Ellipse(&rc);rn //恢复DC原状rn pDC->SelectObject(pOldBrush);rnrn return bRet;rnrnrnvoid CfuxuandanxuanDlg::OnBnClickedChkBlue()rnrn rnInvalidate();rnrnrnvoid CfuxuandanxuanDlg::OnBnClickedChkGreen()rnrn OnBnClickedChkBlue();rnrnrnvoid CfuxuandanxuanDlg::OnBnClickedChkRed()rnrn OnBnClickedChkBlue();rnrnrnvoid CfuxuandanxuanDlg::OnBnClickedRdRect()rnrn OnBnClickedChkBlue();rnrnrnvoid CfuxuandanxuanDlg::OnBnClickedRdRound()rnrn OnBnClickedChkBlue();rnrn运行了出现如题的错误。 rn请教高手。。 论坛

没有更多推荐了,返回首页