[API]
LoadImageA

[INCLUDE]
LoadResEx_MultiOS

[CODE]
Public Function LoadResEx_Image_MultiOS(ByVal ResID As Long, ByVal ResType As Long, Optional ByVal DesiredSize As Long = 32&) As Long
  Dim xLong1 As Long
  Dim xFlags As Long
  
  If resType = 0& Then
    xFlags = &H2040&
    DesiredSize = 0&
    End If

  #If LoadResEx_SetThemeFile Then
    For xLong1 = LoadResex_Caps_WinDIcon To 0& Step -1&
      If LoadResEx_IconIDIsUseable(xLong1, LoadResex_Caps_WinDIcon) Then
        LoadResEx_Image_MultiOS = LoadImageA(LoadResEx_ThemeFile_hModule, ByVal (ResID + xLong1), ResType, DesiredSize, DesiredSize, xFlags)
        If Not LoadResEx_Image_MultiOS = 0& Then Exit Function
        End If
      Next
    #End If

  For xLong1 = LoadResex_Caps_WinDIcon To 0& Step -1&
    If LoadResEx_IconIDIsUseable(xLong1, LoadResex_Caps_WinDIcon) Then
      LoadResEx_Image_MultiOS = LoadImageA(App.hInstance, ByVal (ResID + xLong1), ResType, DesiredSize, DesiredSize, xFlags)
      If Not LoadResEx_Image_MultiOS = 0& Then Exit Function
      End If
    Next

  #If InIDE And LoadResEx_SetLanguageFile Then
    For xLong1 = LoadResex_Caps_WinDIcon To 0& Step -1&
      If LoadResEx_IconIDIsUseable(xLong1, LoadResex_Caps_WinDIcon) Then
        LoadResEx_Image_MultiOS = LoadImageA(LoadResEx_LanguageFile_hModule, ByVal (ResID + xLong1), ResType, DesiredSize, DesiredSize, xFlags)
        If Not LoadResEx_Image_MultiOS = 0& Then Exit Function
        End If
      Next
    #End If
  End Function