Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Extra libraries, Code snippets, applications etc. » U++ users applications in progress and useful code snippets, including reference examples! » using HexView to view a file
using HexView to view a file [message #37471] Wed, 10 October 2012 09:53 Go to next message
omari is currently offline  omari
Messages: 264
Registered: March 2010
Experienced Member
Hello,

I used the control HexView to view a file, here is the code:

main.cpp:


#include <CtrlLib/CtrlLib.h>
#include <HexView/HexView.h>

using namespace Upp;

struct StringHexView : HexView {
	String str;
	
	virtual int Byte(int64 addr)
	{
		return addr < str.GetCount() ? (byte)str[addr]: 0;
	}

	void SetString(String s)
	{
		str = s;
		SetTotal(str.GetCount());
	}

	StringHexView()              {SetTotal(0); }
};


class HexViewer : public TopWindow {
public:
	typedef HexViewer CLASSNAME;
	HexViewer();
	StringHexView  hex;
};

HexViewer::HexViewer()
{
	Add(hex);
	
	Zoomable().Sizeable();
	
	hex.HSizePosZ(36, 36).VSizePosZ(32, 12);
	hex.SetString( LoadFile(GetExeFilePath()));
}

GUI_APP_MAIN
{
	HexViewer().Run();
}



upp file:
uses
	CtrlLib,
	HexView;

file
	main.cpp;

mainconfig
	"" = "GUI SSE2";  


index.php?t=getfile&id=3884&private=0
  • Attachment: hexviewer.PNG
    (Size: 17.47KB, Downloaded 550 times)


regards
omari.

[Updated on: Thu, 11 October 2012 09:21]

Report message to a moderator

Re: using HexView to view a file [message #38704 is a reply to message #37471] Tue, 08 January 2013 01:21 Go to previous message
lectus is currently offline  lectus
Messages: 329
Registered: September 2006
Location: Brazil
Senior Member
Thanks!

Very interesting!

Can it also edit files?
Previous Topic: Tool to download the latest U++ Nightly Build
Next Topic: Create installer .deb or .rpm
Goto Forum:
  


Current Time: Fri Apr 19 15:25:21 CEST 2024

Total time taken to generate the page: 0.03161 seconds