' menu text
'获取指定的菜单项的文本。
Function FF_Menu_GetText(ByVal hMenu as HMENU, ByVal idItem as Long) as CWSTR
   
   Dim mType as MenuItemInfo
   Dim nBuffer() as UByte
   
   mType.cbSize = SizeOf(mType)
   mType.fMask = MIIM_STRING
   mType.dwTypeData = 0
   
   'Get the size of the string first
   If GetMenuItemInfo(hMenu, idItem, False, VarPtr(mType)) Then
      mType.cch = mType.cch + 1  ' make room for the trailing Nul.
      redim nBuffer(mType.cch * 2 + 2)
      'Now get the actual string into the buffer
      mType.dwTypeData =Cast(LPWSTR, @nBuffer(0) )
      If GetMenuItemInfo(hMenu, idItem, False, VarPtr(mType)) Then
         Return *CPtr(WString ptr,@nBuffer(0))
      End If
      
   End If
      Return ""

End Function

