(@engkin: Thanks)
Final part of the menu troubles: mnemonics
Additionally to the bug concerning the dwTypedata field in TWin32WSMenuItem.AttachMenu, there is also a problem with the fMask field.
MIIM_TYPE is used currently in the code (to retrieve or set the fType and dwTypeData fields). Unfortunately this option value is only valid for the versions of Windows anterior to Windows 98. For Windows 98 and later, MIIM_BITMAP, MIIM_FTYPE, and MIIM_STRING must be used instead (see
http://msdn.microsoft.com/en-us/library/windows/desktop/ms647578%28v=vs.85%29.aspx ).
Consequently, setting the caption of the menuitem is not working for Windows 98 and later (i.e. MIIM_TYPE is REALLY not supported in these cases). It's probably related to the size of the MENUITEMINFO structure: when the Windows 95 size is used (44 bytes) MIIM_TYPE is accepted, but when Windows 98+ size is used (48 bytes, hbmpItem added), MIIM_BITMAP, MIIM_FTYPE, and MIIM_STRING must be used instead.
After a few tests, replacing MIIM_TYPE by MIIM_FTYPE or by (MIIM_FTYPE or MIIM_STRING), depending of the type of the call is working properly (i.e. the screen reader indicates the mmemonics).
Using different parameters for Windows95 or Windows98+ versions is not really a problem, as there is already one variable (i.e. menuiteminfosize) which is set depending of the Windows version in the current code.
As a conclusion, troubles and fixes:
1/ Accelerators:
-UpdateCaption method must be modified to add the accelerator(s) if present into the menu caption (using the existing MenuItemShortCut function),
-plus (unless I'm wrong), the "whole" caption (i.e. caption + eventual accelerator text) must be converted (UTF8ToUTF16 and Utf8ToAnsi), and conditional code must be used (using as usual WindowsUnicodeSupport, UnicodeEnabledOS for GetMenuItemInfoA / GetMenuItemInfoW and SetMenuItemInfoA / SetMenuItemInfoW).
2/ Mnemonics:
-bug fix for the caption into the AttachMenu method (i.e. wrong instruction dwTypeData := PChar(AMenuItem)),
-using MIIM_FTYPE or (MIIM_FTYPE or MIIM_STRING), instead of MIIM_TYPE for Windows98+,
-plus (unless I'm wrong), utf8 to ansi/widechar conversions and usual conditional code (InsertMenuItemA, InsertMenuItemW).