Click here to Skip to main content
Licence 
First Posted 17 Jul 2003
Views 80,268
Bookmarked 29 times

Simple Hex Editor

By | 27 Jul 2003 | Article
A simple hex editor

Hex Editor

Introduction

One of the most useful tools for programmers is a good Hex editor. So, I decided to throw one together. There is lots of room for more features, such as find functionality, but it is still a good hex editor. It is a good example of how to implement custom document views.

Description

The applications is SDI, with a view based off of CScrollView. The data is loaded into a CString object. I used CString because of its easy memory management (GetBuffer() and Empty() were all I needed). The view class manually draws the text data twice, in ASCII on the left and in hex on the right. Simple highlighting and cursor control is written into the view class, while data manipulation is handled by the data interface. It was really more for my own experience, but I decided that it might be a handy example for fellow programmers on a similar path.

Points of interest

The scrolling may or may not be implemented the way it was intended. I couldn't find very good documentation on how to get it working perfectly, so I set the origins to the top left and simply calculated the visible lines myself. There may be a better way to do that (if there is, tell me), but the end result is that I only draw what I need, making the rendering fast enough to be usable. I also managed to avoid erasing the screen for everything except scrolling.

Known bugs

There are probably quite a few. Meh.

Updates

July 24, 2003 - Fixed the package, fixed drawing to use a memory dc making scrolling smooth, attempted to fix mousewheel scrolling (unable to confirm, no mouse to test with), used window color instead of plain white for background, disabled printing, fixed signed/unsigned warnings.

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

About the Author

PaulFrazee



United States United States

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
SuggestionNew feature PinmemberWillianBR6:06 5 Jan '12  
GeneralQuick 'n' dirty way Pinmemberandwan011:45 7 Jun '09  
GeneralImportant Question PinmemberFabian Ganter3:12 7 Aug '08  
GeneralHex Edit 2.5F PinmemberAndrew Phillips18:22 7 Apr '08  
GeneralFree hex editor with MFC source PinmemberAndrew Phillips12:02 1 Mar '05  
GeneralRe: Free hex editor with MFC source PinmemberPaulFrazee11:25 2 Mar '05  
GeneralThis is not an editor... it is a viewer! PinmemberSpiceworm10:55 22 Feb '05  
GeneralRe: This is not an editor... it is a viewer! PinmemberPaulFrazee17:15 22 Feb '05  
GeneralShould be more function. PinmemberICE_WIZARD6:18 22 Jul '03  
GeneralQuick and Dirty fixes PinmemberMcGarrah15:55 21 Jul '03  
GeneralRe: Quick and Dirty fixes PinmemberPaulFrazee11:15 22 Jul '03  
GeneralMissing files & bugs Pinmemberbillgatest1:27 19 Jul '03  
GeneralRe: Missing files & bugs PinmemberPaulFrazee8:42 19 Jul '03  
GeneralScrolling doesn't work PinmemberDominik Reichl6:01 18 Jul '03  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web04 | 2.5.120517.1 | Last Updated 28 Jul 2003
Article Copyright 2003 by PaulFrazee
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid