PowerBASIC Users Meeting Point
PB Hex Viewer - Printable Version

+- PowerBASIC Users Meeting Point (http://pump.richheimer.de)
+-- Forum: User to User Discussions (http://pump.richheimer.de/forumdisplay.php?fid=3)
+--- Forum: PowerBASIC for Windows (http://pump.richheimer.de/forumdisplay.php?fid=4)
+--- Thread: PB Hex Viewer (/showthread.php?tid=113)



PB Hex Viewer - Eros Olmi - 27.01.2026

Ciao,

I've attached a project I was working some time ago where I experimented AI (OpenAI ChatGPT and Google Gemini together) to code with some help ... well ... a lot of help.

It's a classic visual HEX viewer control able to show some memory buffer.
Clicking on the left hidden panel there are some options to change viewer

Attached source code and executable.
Do whatever with the sources.

Hope it can help someone.

Ciao
Eros


RE: PB Hex Viewer - Jules Marchildon - 28.01.2026

Eros,  many thanks for posting!  A different take  hex viewer than I've seen before w.r.t. the cross-hair highlighting aspects. I like it very much!


RE: PB Hex Viewer - Jules Marchildon - 28.01.2026

Eros, I had a chance to review your code. Thanks again!

I noticed the cursor wasn't changing for me when hovering over the scroll bar, it remained I-beam cursor. I added an extra line to make sure it changes to the arrow cursor and a couple minor safe improvements inside HexCtrl_WndProc().

Code:
CASE %WM_SETCURSOR

      '-should only change the cursoer when LOWORD(lParam) = %HTCLIENT,
      ' otherwise Windows resets it right after you call SetCursor
      IF LOWRD(lParam) <> %HTCLIENT THEN EXIT SELECT
      IF wParam <> hWnd THEN EXIT SELECT
      
      pState = HexCtrl_GetState(hWnd)

      '-If you exit the SELECT without returning FUNCTION = 1 then
      ' windows will call DefWindowProc which resets the cursor back to I-beam.
      'IF pState = 0 THEN EXIT SELECT
      IF pState = 0 THEN  FUNCTION = 0 :EXIT FUNCTION '-safer option.



RE: PB Hex Viewer - Eros Olmi - 28.01.2026

I am happy it can help.

Also considering code was almost 95% written by AI by continuous prompting.
I just made few manual corrections when AI mixed syntax from other programming languages not compatible with PB10.
But also, in that case I instructed AI to fix and learn.

It took me a total of around not consecutive 2 hours to write code.

I started with OpenAI ChatGPT Pro but after some time and code size ... it started to forget about previous prompting and new features started to destroy already working code.

So, I got the whole code and continue with Google free Gemini and I have to say it was a little better feeling.
Only problem with free plan was that token consumption was too fast, so instructed it not to add anything not asked by me otherwise at every prompt Gemini is, in general, too prolific.

I'm using AI systems for any aspect of my job and I have to say I got a lot of ideas and in particular many different unexpected and interesting point of view on things.