Search code examples
c++.netnativeplatformlanguage-interoperability

Naming conventions used in Platform Invocation in .NET


I have been using the Microsoft P/Invoke Interop Assistant tool to generate some structures, delegates etc. from native C/C++ code.

An example of one of these is a function pointer (delegate), which resolves in managed code to the following names:

EnumCalendarInfoProcA
EnumCalendarInfoProcW
EnumCalendarInfoProcExA
EnumCalendarInfoProcExW

Can anyone explain the difference between A and W and ExA and ExW?


Solution

  • Some functions have several formats. Either Ascii (MessageBoxA) or wide char / unicode (MessageBoxW). When a function does the same, but more, the name usually gets a postfix 'Ex', and probably means extended.

    Like the following functions

    MessageBox: http://msdn.microsoft.com/en-us/library/windows/desktop/ms645505(v=vs.85).aspx

    MessageBoxEx: http://msdn.microsoft.com/en-us/library/windows/desktop/ms645507(v=vs.85).aspx

    where MessageBoxEx is extended by the parameter wLanguageId.