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  |
omari
Messages: 276 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";

regards
omari.
[Updated on: Thu, 11 October 2012 09:21] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Mon Apr 28 23:40:31 CEST 2025
Total time taken to generate the page: 0.00966 seconds
|