How does one differentiate Program Files folders in various environments?

For 32-bit machines, apps usually are in C:\Program Files whereas on 64-bit
machines 32-bit apps are usually in C:\Program Files(X86) and 64-bit apps
usually are in C:\Program Files.
Is "%PROGRAMFILESDIR%" sufficient? Does MS Windows handle the decision
making or is there something else one should know and do, to be able to
distribute the same installer?

Sim