Что нового

[Элементы GUI] Пустая иконка

Ganibal95

GreenBytes
Сообщения
877
Репутация
240
Здравствуйте, в http://autoit-script.ru/index.php/topic,10574.0.html
Есть баг, некоторые иконки пустые.
Я использую эту функцию:
Код:
Func _GAPIPlus_ImageCreateFromIcoFile($sIco, $Index = -1, $W = 32, $H = 32)
	Local $hIcon, $aInfo, $tBits, $pBits, $hBitmap
	_GDIPlus_Startup()
	if $Index == -1 Then
		if $W >= 32 And $H >= 32 Then
			$hIcon = _WinAPI_ShellExtractAssociatedIcon($sIco,0)
			if not $hIcon Then $hIcon = _WinAPI_ShellExtractAssociatedIcon($sIco,1)
		Else
			$hIcon = _WinAPI_ShellExtractAssociatedIcon($sIco,1)
			if not $hIcon Then $hIcon = _WinAPI_ShellExtractAssociatedIcon($sIco,0)
		EndIf
	Else
		$hIcon = _WinAPI_ShellExtractIcon($sIco, $Index, $W, $H)
		if not $hIcon Then $hIcon = _WinAPI_ShellExtractAssociatedIcon($sIco,0)
		if not $hIcon Then $hIcon = _WinAPI_ShellExtractAssociatedIcon($sIco,1)
	EndIf
	$aInfo = _WinAPI_GetIconInfo($hIcon)
	$tBits = DllStructCreate('byte[' & (4 * $W * $H) & ']')
	$pBits = DllStructGetPtr($tBits)
	_WinAPI_GetBitmapBits($aInfo[5], DllStructGetSize($tBits), $pBits)
	$hBitmap = _GDIPlus_BitmapCreateFromScan0($W, $H, 4 * $W, $GDIP_PXF32ARGB, $pBits)
	_WinAPI_DestroyIcon($hIcon)
    _WinAPI_DeleteObject($aInfo[4])
	_WinAPI_DeleteObject($aInfo[5])
	_GDIPlus_Shutdown()
	Return $hBitmap
EndFunc


Некоторые иконки показаны вот так:

Вот иконка
Ссылка на иконку: http://Ganiball-95.narod2.ru/TempoviK/1713.45649476887.ico


Добавлено:
Сообщение автоматически объединено:

UP
 
Верх