Click here to Skip to main content
15,886,810 members
Articles / Programming Languages / C++

Undocumented Visual C++

Rate me:
Please Sign up or sign in to vote.
4.91/5 (75 votes)
17 Sep 2000 743.8K   3.6K   278  
Spelunking in the Badlands of MSDEV
//*******************************************************************************
// COPYRIGHT NOTES
// ---------------
// You may use, compile or redistribute this source as part of your application 
// for free. You may not redistribute it as a part of a software development 
// library without the agreement of the author. If the sources are 
// distributed along with the application, you should leave the original 
// copyright notes in the source code without any changes.
// This code can be used WITHOUT ANY WARRANTIES on your own risk.
// 
// Nick Hodapp
// nhodapp@codeveloper.com
//
//*******************************************************************************

#if !defined(AFX_DLGCLASSES_H__6D10F9C3_C431_4AB4_A950_4A4F157617CA__INCLUDED_)
#define AFX_DLGCLASSES_H__6D10F9C3_C431_4AB4_A950_4A4F157617CA__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "resource.h"

#include "ClassView.h"
#include "GridCtrl_src\GridCtrl.h"
#include "TreeColumn_src\TreeColumn.h"

/////////////////////////////////////////////////////////////////////////////
// CDlgClasses dialog

class CClassView;

class CDlgClasses : public CDialog
{
protected:

	//{{AFX_DATA(CDlgClasses)
	enum { IDD = IDD_UNDOCUMENTEDVC };
	CStatic	m_staticCount;
	CEdit	m_editCode;
	int		m_iMode;
	CString	m_strItemCount;
	CString	m_strCode;
	//}}AFX_DATA

	//{{AFX_VIRTUAL(CDlgClasses)
	virtual void DoDataExchange(CDataExchange* pDX);
	virtual void PostNcDestroy();
	//}}AFX_VIRTUAL

	//{{AFX_MSG(CDlgClasses)
	virtual void OnOK();
	virtual BOOL OnInitDialog();
	afx_msg void OnModeChange();
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg BOOL OnSelChanged( UINT id, NMHDR * pNotifyStruct, LRESULT * result );
	virtual void OnCancel();
	//}}AFX_MSG

	DECLARE_MESSAGE_MAP()

private:

	class CUnprotectedDocTemplate : public CDocTemplate
	{
	public:

		void InsertClasses(CDlgClasses* pThis)
		{
			pThis->InsertClass(pThis, GetRuntimeClass());
			pThis->InsertClass(pThis, m_pDocClass);
			pThis->InsertClass(pThis, m_pFrameClass);
			pThis->InsertClass(pThis, m_pViewClass);
			pThis->InsertClass(pThis, m_pOleFrameClass);
			pThis->InsertClass(pThis, m_pOleViewClass);
		}
	};

	typedef struct tagClass
	{
		CString				m_strClass;

		CString				m_strParent;

		CRuntimeClass*		m_prcInfo;

		CString				m_strCode;
		
		DWORD					m_dwUnique;

		bool					m_bAnalyzed;

		tagClass(CString strClass, CString strParent, CRuntimeClass* prcInfo)
		:	m_strClass(strClass),
			m_strParent(strParent),
			m_dwUnique(0),
			m_bAnalyzed(false)
		{
			m_prcInfo = prcInfo;
		}

	} SClass;
	
	typedef std::map<CString, SClass> M_Class;
	M_Class					m_mapClassInfo;

	M_String 				m_mapClassHierarchy;

	CClassView				m_classView;

	CGridCtrl				m_grid;
	CTreeColumn				m_gridTreeCol;

	typedef std::vector<unsigned char> V_Char;
	V_Char					m_vecLevels;

	CFont						m_courier;

	friend class CUnprotectedDocTemplate;

private:

	void						Struct(DWORD dwUnique, CRuntimeClass* prc, DWORD dwOffset, const char* cpszType, bool bPointer, long lTypeSize, DWORD& dwUnknownCt);

	void						StructBegin(SClass& cls);

	void						StructMember(SClass& cls, const char* cpszType, bool bPointer, long lCount = 1);

	void						StructEnd(SClass& cls);

	bool						GetRuntimeInfo(void* pvObj, CRuntimeClass** pprc);

	void						AnalyzeObject(CObject* pObj);

	void						InsertClassRow(CRuntimeClass* prc, unsigned char ucLevel);

	void						InsertClass(CDlgClasses* pThis, CRuntimeClass* pClass, CObject* pObj = NULL);

	static BOOL CALLBACK EnumClasses(HWND hwnd, LPARAM lParam);

	void						Refresh();

	void						RecalcLayout();

public:
								CDlgClasses(CWnd* pParent = NULL);   // standard constructor
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_DLGCLASSES_H__6D10F9C3_C431_4AB4_A950_4A4F157617CA__INCLUDED_)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions