October 30, 2020, 10:37:18 pm

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


An ASCII / HEX table

Started by GWS, March 17, 2013, 10:22:43 am

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

GWS

March 17, 2013, 10:22:43 am Last Edit: March 18, 2013, 02:50:34 am by GWS
Hi,

Here's a little program showing a table of Ascii characters, their Ascii codes and the corresponding Hex values.

You can select which value you're are interested in, and when you click on the character in the left column, it will be copied to the clipboard.  You can then paste the character at the current cursor position (or its Ascii or Hex value if you chose one of those using the buttons at the bottom).

You can paste the values into your code or some other program like Word  :)

I haven't activated Form Feed (FF) since I don't think this is used much these days .. you can easily add it or any other control characters if you wish. 

There seem to be many sets of Ascii extended characters listed on the internet - I've used a set I thought might prove most useful in text or source code.  Some characters used in other implementations I've seen will not always print or display reliably.

all the best, :)

Graham
Tomorrow may be too late ..

Brian

Thanks for that one, Graham, very handy

I've converted it to IWB, and put in a Fletchie Special API call to SendToClipboard, instead of using
the hidden richtext

Brian

GWS

That sounds good Brian ..  :) .. I'm all for simplification.

Are you going to post it in the IWB section ?  I'd like to see how Fletchie did that ..  ;D

If it's super-slick, I'll do a revised version ..

best wishes, :)

Graham

Tomorrow may be too late ..

GWS

I've changed the size of the Dialog by a couple of pixels - I'd noticed the LV horizontal scrollbar had reappeared following a last minute change ..  ::)  It's gone again now ..  :)

Graham
Tomorrow may be too late ..

Brian

Sorry, Graham, it's not super-slick - it's just like your offering!

Probably be tomorrow, out tonight babysitting...

Brian

Brian

Got let off the babysitting - having to spend the night all by myself (oh no!)

But it gives you the time to do more interesting things, like finishing off Graham's Ascii Chart...

File attached for IWB - appears to work OK. Dispenses with the hidden richedit control, and
uses the API to send the character(s) to clipboard, using Fletchie's ctl.inc

Brian

GWS

Thanks Brian .. it does work with a few snags ..  :) .. it needs ctl.inc and ctl.lib in order to work.
I've never been a fan of including large libraries when I only need one or two functions in a particular program.

The line: $include "ctl.inc", covers a huge set of routines that Fletchie worked on.

In there somewhere is the function SendToClipBoard() .. and it's usage involved this sort of thing ..

Code Select

DECLARE "kernel32",GlobalAlloc(flags:INT,bytes:INT),INT
DECLARE "kernel32",GlobalLock(handle:INT),INT
DECLARE "kernel32",GlobalUnlock(handle:INT),INT
DECLARE "kernel32",RtlMoveMemory(dest:INT,source:STRING,length:INT),INT
DECLARE "user32",OpenClipboard(hwnd:WINDOW),INT
DECLARE "user32",EmptyClipboard(),INT
DECLARE "user32",SetClipboardData(format:INT,handle:INT),INT
DECLARE "user32",CloseClipboard(),INT

....

sub SendToClipBoard(text:string)

DEF handle,lock:INT
     handle = GlobalAlloc(@GHND,255)
     lock = GlobalLock(handle)
     RtlMoveMemory(lock,text,len(text)+1)
     GlobalUnlock(handle)
     OpenClipboard(w1)
     EmptyClipboard()
     SetClipboardData(@CF_OEMTEXT,handle)
     CloseClipboard()
return



As you can see, it's not easy stuff ..  :o

So in this case, I think maybe the Rich Edit control is perhaps simpler to use. :)

I also notice you have the same strange effect that I got in IWB, with the 'Char' button retaining focus all the time  .. I've no idea why that is.

all the best, :)

Graham

Tomorrow may be too late ..

Brian

Graham,
As far as I am aware, when you include something like "ctl.inc" only the functions you need
for your selected call to work are included at compile time, not the whole library
Brian