Click here to Skip to main content
15,893,588 members
Articles / Desktop Programming / WTL

Generator for Include File Guards

Rate me:
Please Sign up or sign in to vote.
4.20/5 (2 votes)
18 Jul 2001 55.5K   578   19  
A little utility that generates header file guards against multiple inclusion.
// maindlg.h : interface of the CMainDialog class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_MAINDLG_H__A15689FC_44F5_45C4_9262_C23B37097387__INCLUDED_)
#define AFX_MAINDLG_H__A15689FC_44F5_45C4_9262_C23B37097387__INCLUDED_

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

class CMainDialog : public CDialogImpl<CMainDialog>, public CUpdateUI<CMainDialog>,
		public CMessageFilter, public CIdleHandler
{
public:
	enum { IDD = IDD_MAINDIALOG };

	virtual BOOL PreTranslateMessage(MSG* pMsg);
	virtual BOOL OnIdle();

protected:
	LRESULT OnInitDialog(HWND, LPARAM);
	LRESULT OnAppAbout(uint /*notifyCode*/, int /*id*/, HWND /*hCtrl*/);
	LRESULT OnOK(uint /*notifyCode*/, int id, HWND /*hCtrl*/);
	LRESULT OnCancel(uint /*notifyCode*/, int id, HWND /*hCtrl*/);

	void CloseDialog(int val);
	CString GetWindowText(const CWindow&);
	CString CreateGuid();
	CString CreateGuard(const CString strHeader, CString strGuid);

private:
	CEdit m_header;
	CEdit m_guard;

	BEGIN_MSG_MAP_EX(CMainDialog)
		MSG_WM_INITDIALOG(OnInitDialog)
		COMMAND_ID_HANDLER_EX(ID_APP_ABOUT, OnAppAbout)
		COMMAND_ID_HANDLER_EX(IDOK, OnOK)
		COMMAND_ID_HANDLER_EX(IDCANCEL, OnCancel)
	END_MSG_MAP()

	BEGIN_UPDATE_UI_MAP(CMainDialog)
	END_UPDATE_UI_MAP()
};


/////////////////////////////////////////////////////////////////////////////

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

#endif // !defined(AFX_MAINDLG_H__A15689FC_44F5_45C4_9262_C23B37097387__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
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