The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: Dubhe on December 21, 2005, 03:41:31 PM

Title: Newbie question on API calls, or, to A or not to A
Post by: Dubhe on December 21, 2005, 03:41:31 PM
I am just now moving from DOS 16 bit MASM to Windows programming via MASM32. I have a question about Windows API calls.

I am following Pirogov's book, "The Assembly Programming Master Book" as a tutorial.  Early in the book, he makes a statement about the naming convention for calling Windows API functions from assembly. Specifically, some API function names contain an "A" before the byte length of the parameters and some don't. For example:

SendMessageA@16 has the A

UpdateWindow@4 does not

I'm sure that I'm missing something that's obvious to everyone else, but so far, I haven't figured out when to add the A and when not to. What are the rules?
Title: Re: Newbie question on API calls, or, to A or not to A
Post by: Mincho Georgiev on December 21, 2005, 04:21:53 PM
Hi, Dubhe!

the "A" means  ANSI Character set
the "W" Unicode Character Set

wich means that SendMessageA is API function from ANSI Character set processing type
and SendMessageW is API  function from Unicode Character Set processing type.
So,if your Application is not going to use Unicode, the answer of your question is "to A" :)

Title: Re: Newbie question on API calls, or, to A or not to A
Post by: elephanto on December 21, 2005, 08:10:04 PM
Quote from: Dubhe on December 21, 2005, 03:41:31 PM
I am just now moving from DOS 16 bit MASM to Windows programming via MASM32. I have a question about Windows API calls.

I am following Pirogov's book, "The Assembly Programming Master Book" as a tutorial.

If I were you I would start with Iczelion's tutorials instead of that book. That book may be good as a reference but it isn't what I was looking for as a tutorial. Most people (at least in here) use different coding style than Pirogov. And I mean "different". Take it into account.
Title: Re: Newbie question on API calls, or, to A or not to A
Post by: Dubhe on December 21, 2005, 10:25:07 PM
Thanks for the heads-up!  :U

I'll take a look at it.
Title: Re: Newbie question on API calls, or, to A or not to A
Post by: tenkey on December 21, 2005, 11:13:32 PM
One other thing.

UpdateWindow NEVER has string data passed to it, directly or indirectly (through structures). So there is no need for two versions (A vs. W).
Title: Re: Newbie question on API calls, or, to A or not to A
Post by: raymond on December 22, 2005, 04:13:31 AM
Furthermore, when you use MASM32 and the provided include files, most (if not all) APIs which would require the "A" or "W" suffix default to the "A" suffix when no suffix is specified.

Raymond