Click here to Skip to main content
15,888,610 members
Articles / Desktop Programming / MFC

Documenting Header Files

Rate me:
Please Sign up or sign in to vote.
2.95/5 (14 votes)
16 Sep 2003CPOL6 min read 63.8K   844   24  
This tool will turn a header file into an XML and/or HTML file for documentation purposes. The output may be merged with previously created or edited XML files.
// MainFrame.cpp : Implementierung der Klasse CMainFrame
//

#include "stdafx.h"
#include "HeaderDocumentor.h"

#include "MainFrame.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CMainFrame

IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)

BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
	//{{AFX_MSG_MAP(CMainFrame)
	ON_WM_CREATE()
	ON_WM_HELPINFO()
	ON_COMMAND(ID_HELP_FINDER, OnHelpFinder)
	ON_COMMAND(ID_HELP, OnHelp)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

static UINT indicators[] =
{
	ID_SEPARATOR,           // Statusleistenanzeige
	ID_INDICATOR_CAPS,
	ID_INDICATOR_NUM,
	ID_INDICATOR_SCRL,
};

/////////////////////////////////////////////////////////////////////////////
// CMainFrame Konstruktion/Zerst�rung

CMainFrame::CMainFrame()
{ m_dwCookie   = 0;
  CWinApp* pApp = ::AfxGetApp();
  if( NULL == pApp ) return;
  HtmlHelp(NULL,NULL,HH_INITIALIZE,(DWORD)&m_dwCookie) ; // Cookie returned by Hhctrl.ocx.
}

CMainFrame::~CMainFrame()
{ if( 0 != m_dwCookie )
     HtmlHelp(NULL,NULL,HH_UNINITIALIZE ,m_dwCookie);
}

int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
		| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
		!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
	{
		TRACE0("Symbolleiste konnte nicht erstellt werden\n");
		return -1;      // Fehler bei Erstellung
	}

	if (!m_wndStatusBar.Create(this) ||
		!m_wndStatusBar.SetIndicators(indicators,
		  sizeof(indicators)/sizeof(UINT)))
	{
		TRACE0("Statusleiste konnte nicht erstellt werden\n");
		return -1;      // Fehler bei Erstellung
	}

	// ZU ERLEDIGEN: L�schen Sie diese drei Zeilen, wenn Sie nicht wollen, dass die Symbolleiste
	//  andockbar ist.
	m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
	EnableDocking(CBRS_ALIGN_ANY);
	DockControlBar(&m_wndToolBar);

	return 0;
}

BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
	if( !CFrameWnd::PreCreateWindow(cs) )
		return FALSE;
	// ZU ERLEDIGEN: �ndern Sie hier die Fensterklasse oder das Erscheinungsbild, indem Sie
	//  CREATESTRUCT cs modifizieren.

	return TRUE;
}

/////////////////////////////////////////////////////////////////////////////
// CMainFrame Diagnose

#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
	CFrameWnd::AssertValid();
}

void CMainFrame::Dump(CDumpContext& dc) const
{
	CFrameWnd::Dump(dc);
}

#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CMainFrame Nachrichten-Handler


BOOL CMainFrame::OnHelpInfo(HELPINFO* pHelpInfo) 
{// We`re using HTML Help so disable
	return TRUE;
}

void CMainFrame::OnHelpFinder() 
{
  CWinApp *pApp   = ::AfxGetApp();
  CString strHelp = pApp->m_pszHelpFilePath;
  HtmlHelp(this->GetSafeHwnd(),strHelp,HH_DISPLAY_TOPIC,0);	
}

void CMainFrame::OnHelp() 
{
  CWinApp *pApp   = ::AfxGetApp();
  CString strHelp = pApp->m_pszHelpFilePath;
  HtmlHelp(this->GetSafeHwnd(),strHelp,HH_DISPLAY_TOPIC,0);	
}

void CMainFrame::WinHelp(DWORD dwData, UINT nCmd) 
{
  CWinApp *pApp   = ::AfxGetApp();
  CString strHelp = pApp->m_pszHelpFilePath;
  HtmlHelp(this->GetSafeHwnd(),strHelp,HH_DISPLAY_TOPIC,0);	
}

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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
Germany Germany
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions