我想编一个可浮动停靠工作空间,其中包含了树视控件。
在一本书上有相关的代码
首先是采用Appwizard exe建立一个多文档的应用程序,
然后通过资源编辑器中的Resource Symbols添加两个ID值IDC_WORKSPACE和IDC_TREECTRL.但这两个资源总是不在使用!
然后自写一个可浮动停靠工作空间类及其实现文件。
问题是,mainframe.cpp中申明这个类的一个实例:CMyCtrlBar m_wndWorkspace时总是报类没有实例化,
如果将这句注释掉就编译成功。
在一本书上有相关的代码
首先是采用Appwizard exe建立一个多文档的应用程序,
然后通过资源编辑器中的Resource Symbols添加两个ID值IDC_WORKSPACE和IDC_TREECTRL.但这两个资源总是不在使用!
然后自写一个可浮动停靠工作空间类及其实现文件。
问题是,mainframe.cpp中申明这个类的一个实例:CMyCtrlBar m_wndWorkspace时总是报类没有实例化,
如果将这句注释掉就编译成功。
解决方案 »
- 请高手指点
- 请问,如何为动态添加的菜单设置响应函数?
- 使用过数字证书签名代码的朋友帮帮忙!
- 小问题,50分,我的CRichEditCtrl继承类为什么在输入汉字时不触发 WM_CHAR 消息!!
- 在客户区画图时,按滚动条时让图形进入不可见区域,再回到原来的区域,图形为什么被擦掉了?
- 难题: ComboBox的DropList模式显示不正常(见源码)
- help!!MFC ODBC 创建数据库如何实现查询(绝对给分)
- mfc,菜单栏使用系统自带的,如何获取到:文件-保存这个菜单项用户填写的值?
- 怎样在DOS下访问SQL Server7.0?
- 拜师学艺!!!有谁收我呀???
- 请问:DrWatson中的错误( c0000005 (访问侵犯))如何修改?
- 菜鸟求救:多线程编程遇到的怪问题!
#if !defined(__MYCTRLBAR_H__)
#define __MYCTRLBAR_H__#include "MyTreeCtrl.h"
#include "Ex19Doc.h"#include <afxpriv.h> // for CDockContext
#include <afxtempl.h> // for CArray#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// MyCtrlBar.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CMyCtrlBar window
class CMyCtrlBar : public CControlBar
{
DECLARE_DYNAMIC(CMyCtrlBar)// Construction
public:
CMyCtrlBar();// Attributes
protected:
BOOL m_bInRecalcNC;
BOOL m_bTracking;
BOOL m_bGripper;
UINT m_cxEdge;
UINT m_nDockBarID;
CSize m_sizeMin;
CSize m_sizeHorz;
CSize m_sizeVert;
CSize m_sizeFloat;
CRect m_rectBorder;
CRect m_rectTracker;
CPoint m_ptOld;
DWORD dwStyle;
// Operations
public:
virtual void OnUpDateCmdUI(CFrameWnd* pTarget,
BOOL bDisableIfNoHndler);
virtual BOOL Create(CWnd* pParentWnd,UINT nID,
LPCTSTR lpszWindowName=NULL,
CSize sizeDefault=CSize(200,200),
DWORD dwStyle=WS_CHILD|WS_VISIBLE|CBRS_TOP);
virtual CSize CalcFixedLayout(BOOL bStretch,BOOL bHorz);
virtual CSize CalcDynamicLayout(int nLength,DWORD dwMode);// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMyCtrlBar)
//}}AFX_VIRTUAL// Implementation
public:
void ReDrawTree(CEx19Doc *pDoc);
TVITEM tvitem;
CMyTreeCtrl* treectrl;
BOOL IsHorzDocked() const;
BOOL IsVertDocked() const;
BOOL IsFloating(); void OnInvertTracker(const CRect& rect);
void StopTracking(BOOL bAccept);
void StartTracking();
CPoint& ClientToWnd(CPoint& point);
virtual ~CMyCtrlBar(); // Generated message map functions
protected:
//{{AFX_MSG(CMyCtrlBar)
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
afx_msg void OnWindowPosChanged(WINDOWPOS FAR* lpwndpos);
afx_msg void OnNcLButtonDown(UINT nHitTest, CPoint point);
afx_msg void OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* lpncsp);
afx_msg void OnNcPaint();
afx_msg UINT OnNcHitTest(CPoint point);
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnCaptureChanged(CWnd *pWnd);
afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
afx_msg void OnPaint();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
///////////////////////////////////////////////////////////////////////////////{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.#endif // !defined(__MYCTRLBAR_H__)