The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: ofg on February 26, 2006, 02:43:55 PM

Title: ASCII Character in ListView SubItem
Post by: ofg on February 26, 2006, 02:43:55 PM
   hi,
    What can I do with the pszText member so that I can write an ASCII character
   (like up-Arrow) in a subitem.
    Any references about related matters or sample code will be appreciated.
    thanks.
Title: Re: ASCII Character in ListView SubItem
Post by: donkey on February 26, 2006, 03:34:39 PM
You can select the font for the listview that you like and use WM_SETFONT to assign it to the listview, there is no "UP ARROW" in the ascii character set however.
Title: Re: ASCII Character in ListView SubItem
Post by: ofg on February 26, 2006, 10:20:45 PM


     What I mean is ASCII Code 18h.
Title: Re: ASCII Character in ListView SubItem
Post by: ofg on February 27, 2006, 12:51:13 AM

  sorry,now I realize that it is a non-printing character
  I think it is reserved for control.
Title: Re: ASCII Character in ListView SubItem
Post by: donkey on February 27, 2006, 02:27:12 AM
All values up to and including character 31 are control characters under the ASCII standard. I think IBM Extended Ascii can print the character you want but I know of no fonts that support that character set though it must exist somewhere. I would search for font packages that include the IBM DOS character set, no Windows or ASCII font will support it though.

http://jimprice.com/jim-asc.htm

It is not a big job to just make your own font by modifying an existing one and you can have whatever you want. Borrow what graphics you need from WingDings or Symbol and modify a font and distribute it with your software. Watch for copyright restrictions though, you will need a freeware/public domain font and the font editor that comes with visual studio.
Title: Re: ASCII Character in ListView SubItem
Post by: Tedd on February 27, 2006, 11:49:46 AM
Or cheat :toothy

Use WM_SETFONT to set the font of the control with the handle as returned by "invoke GetStockObject, OEM_FIXED_FONT"
This gives you the 'dos' character set - including symbols for non-printing characters.
Title: Re: ASCII Character in ListView SubItem
Post by: MichaelW on February 27, 2006, 02:06:22 PM
Thanks Tedd,

It works OK on my system, but can it be depended on to work on all systems?

EDIT : corrected a problem where I substituted 20d instead of 32d for the problem control characters.


[attachment deleted by admin]
Title: Re: ASCII Character in ListView SubItem
Post by: Tedd on February 27, 2006, 06:00:19 PM
Quote from: MichaelW on February 27, 2006, 02:06:22 PM
It works OK on my system, but can it be depended on to work on all systems?

Works okay on win98 and XP. And it's a stock-object, so it would have to be the same on all.
I'm assuming it's the same as what's used for the dos console (yes I know you can change the font, but it's to do with the character conversion.)
Title: Re: ASCII Character in ListView SubItem
Post by: donkey on February 27, 2006, 10:47:52 PM
Quote from: Tedd on February 27, 2006, 06:00:19 PM
Quote from: MichaelW on February 27, 2006, 02:06:22 PM
It works OK on my system, but can it be depended on to work on all systems?

Works okay on win98 and XP. And it's a stock-object, so it would have to be the same on all.
I'm assuming it's the same as what's used for the dos console (yes I know you can change the font, but it's to do with the character conversion.)

Anything that says OEM is dependant on the manufacturer and not guaranteed to be the same across hardware platforms or even from BIOS to BIOS. That said this one should be pretty safe though I would probably look for one I could distribute instead.
Title: Re: ASCII Character in ListView SubItem
Post by: Tedd on February 28, 2006, 11:01:54 AM
It says OEM because it's supposed to simulate what the bios gives you. But it doesn't come from the bios in this case, it's part of windows, and since we're only using windows I think it's fairly safe :wink
Bad naming really.
Title: Re: ASCII Character in ListView SubItem
Post by: donkey on February 28, 2006, 12:31:59 PM
Hi Tedd,

Yup you're right, never really thought about it much but the follwoing article explains it well enough...

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/intl/Unicode_code_pages.asp