I was using this:
#include <GDIPlus.au3>
#include <GuiMenu.au3>
#include <GuiConstantsEx.au3>
_Main()
Exit
Func _GUICtrlMenu_CreateBitmap($file, $iIndex = 0, $iX = 18, $iY = 18)
If FileExists($file) Then
Local $iStride = 0, $iPixelFormat = $GDIP_PXF32ARGB, $pScan0 = 0
Local $GDIp = 1, $aRet, $hIcon, $hImage, $hBitmap, $hContext, $hIcon
$aRet = DllCall("shell32", "long", "ExtractAssociatedIcon", "int", 0, "str", $file, "int*", $iIndex)
If @error Then Return SetEr