PB Hex Viewer
#1
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


Attached Files Thumbnail(s)
       

.bas   HexControl_v0.4.1.bas (Size: 102 KB / Downloads: 11)
.zip   HexControl_v0.4.1.EXE.zip (Size: 28.48 KB / Downloads: 6)
thinBasic Programming Language
https://www.thinbasic.com

Computer: DELL Precision 7550
OS: Windows 10 Pro for Workstations
Processor: Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz 2.81 GHz
RAM: 32,0 GB
Desktop resolution: 3840 x 2160 Scale 200%
Reply
#2
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!
Reply
#3
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.
Reply
#4
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.
thinBasic Programming Language
https://www.thinbasic.com

Computer: DELL Precision 7550
OS: Windows 10 Pro for Workstations
Processor: Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz 2.81 GHz
RAM: 32,0 GB
Desktop resolution: 3840 x 2160 Scale 200%
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)