[clean-list] nCopyAnsiToWideChar

Peter Achten peter88@cs.kun.nl
Mon, 10 Jun 2002 14:49:19 +0200


Hello Serguey,

Thank you for your suggestion. I will check it and (if I understand it ;-) 
include it in the next release of the Object I/O library.

Regards,
Peter Achten

At 00:36 8-6-02 +0400, you wrote:
>Hello clean-list,
>
>I'd like to suggest the following version of nCopyAnsiToWideChar
>function in the file $clean20root/Libraries/ObjectIO 1.2.2/OS
>Windows/Windows_C_12/util_121.c:
>------------------------------------------------------------------------------
>int nCopyAnsiToWideChar (LPWORD lpWCStr, LPSTR lpAnsiIn)
>{
>         int nChar = MultiByteToWideChar(
>                 CP_ACP,         /* default ANSI Code page */
>                 0,              /* no special flags */
>                 lpAnsiIn,       /* multibyte char */
>                 -1,     /* ASCIIZ */
>                 lpWCStr,        /* wide characters (dummy right now) */
>                 0               /* flag that we need to calculate
>                                    string length */
>         );
>         nChar = MultiByteToWideChar(
>                 CP_ACP,         /* default ANSI Code page */
>                 0,              /* no special flags */
>                 lpAnsiIn,       /* multibyte char */
>                 -1,     /* ASCIIZ */
>                 lpWCStr,        /* destination wide character string */
>                 nChar   /* calculated number of wide chars */
>         );
>         if (nChar==0) {    /* failure result */
>                 MessageBox (0,"nCopyAnsiToWideChar 
> fails","MultiByteToWideChar",0);
>                 ExitProcess(255);       /* this is plain wrong but this 
> is windows after all */
>         }
>
>         return nChar;            /* number of chars written */
>}       /* nCopyAnsiToWideChar */
>------------------------------------------------------------------------------
>
>This solves unwanted behavior problem for dialog titles (I had a
>problem with russian characters in dialog title).
>
>This also requires string
>
>------------------------------------------------------------------------------
>MultiByteToWideChar@24
>------------------------------------------------------------------------------
>
>to be added into $clean20root/Libraries/StdEnv 2.0/Clean System
>Files/kernel_library
>
>--
>Best regards,
>  Serguey
>  thesz na mail tochka ru
>  (na == at, tochka == dot)
>
>
>_______________________________________________
>clean-list mailing list
>clean-list@cs.kun.nl
>http://www.cs.kun.nl/mailman/listinfo/clean-list