News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Newbie question on API calls, or, to A or not to A

Started by Dubhe, December 21, 2005, 03:41:31 PM

Previous topic - Next topic

Dubhe

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?

Mincho Georgiev

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" :)


elephanto

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.

Dubhe

Thanks for the heads-up!  :U

I'll take a look at it.

tenkey

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).
A programming language is low level when its programs require attention to the irrelevant.
Alan Perlis, Epigram #8

raymond

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
When you assume something, you risk being wrong half the time
http://www.ray.masmcode.com