No announcement yet.

Windows API with those ending in W and A , what are the differences?

  • Filter
  • Time
  • Show
Clear All
new posts

  • Windows API with those ending in W and A , what are the differences?

    Hi All,

    I was looking at some codes done by the previous programmer, she uses some API functions ending with W and then also ending with A.
    For example LoadImageW and LoadimageA

    What's the difference ? I think that those ending in W are for unicode usage while those ending in A are non unicode usage?

    Please help, as I'm just a newbie programmer.

  • #2
    A = Ansi; W= Wide (Unicode).


    • #3
      As José says:
      A stands for ANSI (single byte encoded characters)
      W stands for WIDE (i.e UTF-16 encoded multi-byte characters)*

      A means that you should use PB's STRNG or STRINGZ variables
      W means that you should use PB's WSTRING or WSTRINGZ variables

      * Unicode is a character set not an encodng method.
      There are several ways to encode Uncode characters.
      MS (and others) inaccurately use the word UNICODE to describe UTF-16 encoded Unicode characters, even though the most common Unicode encoding by far is UTF-8.

      It's worth noting that Windows 10 now uses Unicode by default in Notepad - but not "WIDE" characters - it uses UTF-8.
      So if you asked MS the question "Does Notepad now use Unicode by default?" They'd probably have to answer "Yes and No".


      • #4
        Thank you to both of you
        that explains a lot of things in her programs and usage of the MS API functions


        • #5
          Originally posted by Tim Lakinir View Post
          that explains a lot of things in her programs
          I see by your profile that you are in Canada.
          The "previous programmer" wouldn't be named Anne by any chance, would she?


          • #6
            It's not just the strings. Some of the "Pick 'A' or 'W'" functions reference structures (PB "UDTs") for which there are different definitions depending on SBCS ("A") v DBCS ("W") usage.
            Michael Mattias
            Tal Systems (retired)
            Port Washington WI USA
            [email protected]


            • #7
              SBCS is Single Byte Character Set
              DBCS is Double Byte Character Set
              So it is still strings. Either type string can be an element in a structure/UDT. Therefore the need for "A" or "W" to distinguish.