Unicode and KeyPress event.


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Unicode and KeyPress event.

  1. #1
    Jason Guest

    Unicode and KeyPress event.


    Dan,

    I have a VB 6 app that draws text by creating a logical font from one of
    the installed fonts, catches the Keypress event and sends the KeyAscii paramter
    to a call to GetGlyphOutline and then draws all the vectors to the screen.
    Everything works fine now but we want this app to now work for foreign characters
    (Chinese, Japanese, etc) under Win2000. As I understand it, VB uses Unicode
    internally and converts to ascii when calling a DLL when a string is a parameter.
    However, GetGlyphOutline only expects one UNIT as the "character to query".
    Since this parameter is 32 bits I would expect this parameter to be the
    same for both GetGlyphOutlineW and GetGlyphOutlineA. Is this true? Second
    part is how do I get the Unicode value of a KeyPress event. The name of
    the KeyAscii parameter certainly suggests that it's in Ascii but this value
    is an Integer (16 bits) so it is large enough to be a Unicode value. Any
    suggestions for a book that goes deep into the guts of supporting Unicode,
    most stick to the "FunctionNameA" realm of things.

    Thanks in advance,
    Jason.

    Share on Google+

  2. #2
    Dan Appleman Guest

    Re: Unicode and KeyPress event.

    I've never actually used this function, but I can make some pretty good guesses on
    some of your questions...

    Jason wrote:

    > Dan,
    >
    > I have a VB 6 app that draws text by creating a logical font from one of
    > the installed fonts, catches the Keypress event and sends the KeyAscii paramter
    > to a call to GetGlyphOutline and then draws all the vectors to the screen.
    > Everything works fine now but we want this app to now work for foreign characters
    > (Chinese, Japanese, etc) under Win2000. As I understand it, VB uses Unicode
    > internally and converts to ascii when calling a DLL when a string is a parameter.
    > However, GetGlyphOutline only expects one UNIT as the "character to query".
    > Since this parameter is 32 bits I would expect this parameter to be the
    > same for both GetGlyphOutlineW and GetGlyphOutlineA. Is this true?


    I would not make that assumption. The W version will definitely take a Unicode
    character. The A version would probably take a DBCS character (The double byte
    encoding used for some character sets including most of the Japanese character sets).

    > Second
    > part is how do I get the Unicode value of a KeyPress event. The name of
    > the KeyAscii parameter certainly suggests that it's in Ascii but this value
    > is an Integer (16 bits) so it is large enough to be a Unicode value.


    It's also large enough to hold a DBCS 2 byte character. That would be my guess, but I
    don't know for sure. I would suggest some experimentation to determine exactly what
    you get in this case.

    > Any
    > suggestions for a book that goes deep into the guts of supporting Unicode,
    > most stick to the "FunctionNameA" realm of things.
    >


    Well, my latest book "Dan Appleman's Win32 API Puzzle Book and Tutorial for VB
    Programmers" goes into quite a bit of depth and examples of calling Unicode function
    entry points, and conversions to and from Unicode. I don't know if you're doing this
    yourself or you have a Japanese partner - but I can tell you from past experience that
    having a technically competent crew of Windows developers on the Japanese side is
    invaluable for answering questions like this.


    Best of luck

    Dan


    >
    > Thanks in advance,
    > Jason.


    Share on Google+

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center