[API]
LoadMenuA
LoadMenuW
Public SetMenu
Public DestroyMenu

[DEFINE]
#If InIDE And Not LoadResEx_SetLanguageFile Then
  Private Declare Function LoadMenuInIDEW Lib "user32" Alias "LoadMenuIndirectW" (lpMenuTemplate As Any) As Long
  Private Declare Function LoadMenuInIDEA Lib "user32" Alias "LoadMenuIndirectA" (lpMenuTemplate As Any) As Long
  #End If

[CODE]
Public Function LoadResEx_Menu(ByVal MenuID As Long) As Long
  #If LoadResEx_SetLanguageFile Then
    #If Unicode Then
      If IsUnicode Then
        LoadResEx_Menu = LoadMenuW(LoadResEx_LanguageFile_hModule, StrPtr("#" & CStr(MenuID)))
        Else
        LoadResEx_Menu = LoadMenuA(LoadResEx_LanguageFile_hModule, ByVal "#" & CStr(MenuID))
        End If
      #Else
      LoadResEx_Menu = LoadMenuA(LoadResEx_LanguageFile_hModule, ByVal "#" & CStr(MenuID))
      #End If
    #Else
    #If InIDE Then
      Dim xLong1 As Long
      Dim xChar1 As String
      Dim xByteA1() As Byte
      
      #If LoadResEx_SetLanguageFile Then
        xChar1 = LoadResEx_Data(MenuID, 4&, LoadResEx_LanguageFile_hModule)
        #Else
        xChar1 = LoadResEx_Data(MenuID, 4&, App.hInstance)
        #EndIf
      If Not Len(xChar1) = 0& Then
        On Error GoTo Er1:
        xByteA1() = LoadResData(MenuID, 4&)
        xLong1 = UBound(xByteA1())
        If xLong1 > -1& Then
          xLong1 = xLong1 + 1&
          #If Unicode Then
            If IsUnicode Then
              LoadResEx_Menu = LoadMenuInIDEW(xByteA1(0))
              Else
              LoadResEx_Menu = LoadMenuInIDEA(xByteA1(0))
              End If
            #Else
            LoadResEx_Menu = LoadMenuInIDEA(xByteA1(0))
            #End If
          End If
        End If
Rs1:
      On Error GoTo 0
      Exit Function

Er1:
      Resume Rs1
      
      
      #Else
      #If Unicode Then
        If IsUnicode Then
          LoadResEx_Menu = LoadMenuW(App.hInstance, StrPtr("#" & CStr(MenuID)))
          Else
          LoadResEx_Menu = LoadMenuA(App.hInstance, ByVal "#" & CStr(MenuID))
          End If
        #Else
        LoadResEx_Menu = LoadMenuA(App.hInstance, ByVal "#" & CStr(MenuID))
        #End If
      #End If
    #End If
  End Function
