Re: copymemory basic question



If CopyMemory is used properly then there is no character set translation
involved at all. It's a generic API for moving amorphous memory, i.e. bytes
of data. The API itself doesn't care what the data is, and treats it
literatim. Hence, if any ANSI conversion is being done then it's because the
API declaration is wrong.

Tony Proctor

"Sam Hobbs" <samuel@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:eZwFZQaqFHA.3524@xxxxxxxxxxxxxxxxxxxxxxx
> "mscir" <mscir@xxxxxxxxx> wrote in message
> news:qL-dncH8AMmQhZDeRVn-gA@xxxxxxxxxxxxxxxxx
> >
> > Actually, you might think that the code:
> >
> > CopyMemory lng, s, 4
> >
> > would also work, but it doesn't. In brief, the reason is that when VB
sees
> > that a string is being passed to an API function, it makes a copy of the
> > array in ANSI format (rather than Unicode) and passes the ANSI version
to
> > the function. (For a more detailed discussion of this issue, please see
my
> > book.)
>
> It works, but the string gets converted to ANSI in the process. So "it
> doesn't" just means that the string loses non-ANSI characters.
>
>


.



Relevant Pages

  • Re: copymemory basic question
    ... I think you are saying the same thing that the author is saying except with ... > If CopyMemory is used properly then there is no character set translation ... It's a generic API for moving amorphous memory, ... if any ANSI conversion is being done then it's because ...
    (microsoft.public.vb.winapi)
  • Re: Suggested Alternative Unicode Implementation (for Rudy+ miscothers)
    ... No, not quite, because the VCL is still Unicode so your application will ... to continue to safely run in an "ANSI world" ... This compiles perfectly fine, but maybe it doesn't work correctly for ... "choose" the A/W API, you get the API appropriate to the sype of the ...
    (borland.public.delphi.non-technical)
  • Re: Delphi 2009 - CG tip everything on ( only ) Unicode ?
    ... The Unicode versions of the Win32 API calls are faster then the ANSI ... file and folder names are in Unicode. ...
    (borland.public.delphi.non-technical)
  • Re: Does MAX_PATH include the terminating null?
    ... "Matthias Hofmann" wrote in message ... In some cases it describes the maximum length of a part of a path that you can pass to an API, counted in TCHARs (bytes in ANSI or wchar_ts in Unicode). ... I don't know of any practical limit on the maximum length of a path to a file that can exist on a disk drive. ...
    (microsoft.public.vc.language)
  • Re: Can anyone covert a VB to VB.Net program for me?
    ... > structure and string back without having to jump through hoops. ... > ByRef ppBuffer As string, ByRef lLen As integer) As integer ... My issue is that you have to use the copymemory api to get the info I ...
    (microsoft.public.dotnet.languages.vb)