Windows uses the same calling convention as Microsoft Pascal. Throughout this manual, this calling convention is referred to as the “Pascal calling convention.” In the Pascal calling convention:
Parameters are pushed onto the stack in the order in which they appear in the function call.
The code that restores the stack is part of the called function (rather than the calling function).
This convention differs from the calling convention used in other languages, such as C. In C, parameters are pushed onto the stack in reverse order, and the calling function is responsible for restoring the stack.
When developing Windows applications in a language that does not ordinarily use the Pascal calling convention, such as C, you must ensure that the Pascal calling convention is used for any function that is called by Windows. In C, this requires the use of the PASCAL keyword when the function is declared.