CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 67

Hybrid View

  1. #1
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,772

    Hex Viewer / Editor

    After having read the discution with Rich and Wizbang on this thread, i rememberd one of those shelved progects that I have (I'm trying to either complete or trash and delete them all ).

    I've done some work on a Hex Editor, and it's not looking too bad( 1k Viewer block), only prob is screen update times, the update rolls down the screen (even on a P4 2.4Ghz) .

    Any help with this will be greatly apreciated... (Also comments and sugestions on any extra's I should put in, would be nice.. )

    Functions like Search and Replace are definites that will be put in, eventually . I figure getting the core running smoothly first. then add these functions around that...

    Thanks...

    Gremmy..
    Last edited by GremlinSA; January 7th, 2006 at 03:04 PM. Reason: New Version of file on later Post..
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

  2. #2
    Join Date
    Dec 2001
    Posts
    6,332

    Re: Hex Viewer / Editor

    Wow...out of memory error...

    I do have a few other things running right now, but I can see why the updates go slowly anyway. All those boxes loading, and changing all of them as you scroll through the file will be slower than one would want.

    When I needed a Hex viewer with a certain function (at the moment I'm not sure of the exact reason), I whipped up a quick one. I never got around to doing the editor part. What I did was to use a single textbox for the entire thing. A fixed-width font makes everything line up perfectly. That saves a lot over all those seporate boxes. There is an even better way though - use a picturebox, and draw the text into it. Then you can even use colors if you want. It helps also with a more convenient way to scroll, as I ended up with two scrollbars. However, editing would be a different matter since you'd have to use a seporate textbox for typing into. If you want it to look as though the textbox is part of the viewer box, you would have to line it up according to where the user clicks to edit. That's not as hard as it might sound, but still would obviously take more work than a textbox for displaying. Someday maybe I'll get around to it...but probably not.

    Anyway, here's a screenshot of how it looks the way I did it:
    Attached Images Attached Images  
    Please remember to rate the posts and threads that you find useful.
    How can something be both new and improved at the same time?

  3. #3
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,772

    Re: Hex Viewer / Editor

    Quote Originally Posted by WizBang
    Wow...out of memory error...

    I do have a few other things running right now, but I can see why the updates go slowly anyway. All those boxes loading, and changing all of them as you scroll through the file will be slower than one would want.

    When I needed a Hex viewer with a certain function (at the moment I'm not sure of the exact reason), I whipped up a quick one. I never got around to doing the editor part. What I did was to use a single textbox for the entire thing. A fixed-width font makes everything line up perfectly. That saves a lot over all those seporate boxes. There is an even better way though - use a picturebox, and draw the text into it. Then you can even use colors if you want.
    Not sure why Out of memory... Runs fine (used it for +- 1 hour yesterday) on my system, but i'll look into that..

    Thanks for the advice.. I may just use a Rich text box or the picture method..

    Gremmy...
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

  4. #4
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,772

    Re: Hex Viewer / Editor

    Well i've changed the display to two Rich Text Boxes only.. 1 for Hex, 1 for data.. the display load times has been greatly increased.. Now it's just taking time to convert all the hex editing code to work with single text boxes..

    Thanks Wiz.. its looking much better... will repost when finished the hex editor part..

    Grem.
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

  5. #5
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,772

    Lightbulb Re: Hex Viewer / Editor

    Well I think the editing code is complete, 99% debugged..

    Still waiting for sujestions on what should be included as aditional functions...

    Wiz.. Give this a go....

    Gremmy..

    ----- Edit -----
    New file in later post....
    Last edited by GremlinSA; January 15th, 2006 at 04:41 AM. Reason: Newer File in later post
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

  6. #6
    Join Date
    Dec 2001
    Posts
    6,332

    Re: Hex Viewer / Editor

    Much improved over the last one for sure

    Two issues which I found are that it requires more space than my resolution offers, so I can't see the entire box on the right side. The other thing I noticed is that if you make some changes, then discard them (clear changes), the entire Hex code box has the red characters used to indicate the edited portions. I do like the way navigation works within the "page", though if I was doing this I'd make the thing scroll one line at a time. That would really help keep ones' place while scrolling. In the one I did, I intended to make the ScrollBar do both, such that the buttons scrolled one line at a time, and the LargeChange would be the amount of one page. As stated, I really never finished the program.

    Now, as for suggestions of additional features, I'd add a "Jump To..." thing, so you can skip to any spot in the file. Make it accept Hex or decimal values. Also enable copy/cut/paste/delete, so you can highlight a group of bytes, and do whatever with them. Let's not forget about appending data to the end of the file. Of course, the search stuff you mentioned is a must. It would be interesting to try to make it searchable by bits as well as bytes. How about editing a value with logical operators like And, Or, Xor, Not, etc? The tricky part about that might be when you have a 32 bit value as opposed to an eight bit value, so I guess it could work by the number of bytes selected.

    I guess that's enough to keep you busy for now
    Please remember to rate the posts and threads that you find useful.
    How can something be both new and improved at the same time?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured