Click here to Skip to main content
15,896,606 members
Articles / Programming Languages / C++

HexEdit - Window Binary File Editor

Rate me:
Please Sign up or sign in to vote.
4.96/5 (137 votes)
17 Oct 2012MIT45 min read 497.6K   22.4K   321  
Open-source hex editor with powerful binary templates
//
// Copyright (c) 2011 by Andrew W. Phillips.
//
// This file is distributed under the MIT license, which basically says
// you can do what you want with it but I take no responsibility for bugs.
// See http://www.opensource.org/licenses/mit-license.php for full details.
//

#if !defined(AFX_COPYCSRC_H__2F30ECE7_0758_4E2F_AAFF_A76FB85F3C4D__INCLUDED_)
#define AFX_COPYCSRC_H__2F30ECE7_0758_4E2F_AAFF_A76FB85F3C4D__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// CopyCSrc.h : header file
//

/////////////////////////////////////////////////////////////////////////////
// CCopyCSrc dialog

class CCopyCSrc : public CDialog
{
public:
	enum { STRING, CHAR, INT, FLOAT };  // Matches type_ (which radio button is selected)
	enum { INT_UNSIGNED, INT_SIGNED, INT_OCTAL, INT_HEX };  // Matches order in IDC_CSRC_INT_TYPE
	enum { INT_8, INT_16, INT_32, INT_64 };                 // Matches order IDC_CSRC_INT_SIZE
	enum { FLOAT_32, FLOAT_64, REAL_48 };                   // Matches order IDC_CSRC_FLOAT_SIZE

// Construction
public:
	CCopyCSrc(CWnd* pParent = NULL);   // standard constructor

// Dialog Data
	//{{AFX_DATA(CCopyCSrc)
	enum { IDD = IDD_CSRC };
	CSpinButtonCtrl	ctl_indent_spin_;
	CComboBox	ctl_int_type_;
	CComboBox	ctl_int_size_;
	CComboBox	ctl_float_size_;
	CButton	ctl_big_endian_;
	BOOL	big_endian_;
	int		type_;
	int		float_size_;
	int		int_size_;
	int		int_type_;
	BOOL	show_address_;
	UINT	indent_;
	//}}AFX_DATA


// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CCopyCSrc)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:

	// Generated message map functions
	//{{AFX_MSG(CCopyCSrc)
	afx_msg void OnChangeType();
	virtual BOOL OnInitDialog();
	virtual void OnOK();
	afx_msg void OnCsrcHelp();
	//}}AFX_MSG
	afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo);
	afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
	DECLARE_MESSAGE_MAP()

	void		 fix_controls();
};

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

#endif // !defined(AFX_COPYCSRC_H__2F30ECE7_0758_4E2F_AAFF_A76FB85F3C4D__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, along with any associated source code and files, is licensed under The MIT License


Written By
Australia Australia
Andrew has a BSc (1983) from Sydney University in Computer Science and Mathematics. Andrew began programming professionally in C in 1984 and has since used many languages but mainly C, C++, and C#.

Andrew has a particular interest in STL, .Net, and Agile Development. He has written articles on STL for technical journals such as the C/C++ User's Journal.

In 1997 Andrew began using MFC and released the source code for a Windows binary file editor called HexEdit, which was downloaded more than 1 million times. From 2001 there was a shareware version of HexEdit (later called HexEdit Pro). HexEdit has been updated to uses the new MFC (based on BCG) and is once more open source.

Comments and Discussions