I am porting some Win32 code to C#, and have come accross several functions which have the same names and use the same structures except that they end with A and W
For example:
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("shell32.dll", CallingConvention = CallingConvention.StdCall)]
public static extern bool Shell_NotifyIconA(uint dwMessage, ref NOTIFYICONDATAA lpData);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("shell32.dll", CallingConvention = CallingConvention.StdCall)]
public static extern bool Shell_NotifyIconW(uint dwMessage, ref NOTIFYICONDATAW lpData);
I have seen some implementations in C# which omit the A and W from both the function name, and the associated structure, like so:
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("shell32.dll", CallingConvention = CallingConvention.StdCall)]
public static extern bool Shell_NotifyIcon(uint dwMessage, ref NOTIFYICONDATA lpData);
What I want to know is:
What do A and W denote?
In C#, should I implement the functions as shown above, using both A and W, or is it better practice to omit A and W in favour of having a single implementation?