Funktionreferenz


_WinAPI_LoadIconWithScaleDown


Loads an icon and scales down a larger image instead of scaling up a smaller image

#include <WinAPIIcons.au3>
_WinAPI_LoadIconWithScaleDown ( $hInstance, $sName, $iWidth, $iHeight )

Parameter

$hInstance Handle to the module of either a DLL or executable (.exe) file that contains the icon to be loaded.
$sName The information about the icon to load. If $hInstance is not 0, $sName specifies the icon resource
either by name or ordinal, otherwise, $sName specifies either the name of a standalone icon (.ico)
file or the identifier of a predefined icon to load.
$IDI_APPLICATION
$IDI_HAND
$IDI_QUESTION
$IDI_EXCLAMATION
$IDI_ASTERISK
$IDI_WINLOGO
$IDI_SHIELD
$IDI_ERROR
$IDI_INFORMATION
$IDI_WARNING
$iWidth The desired width, in pixels, of the icon.
$iHeight The desired height, in pixels, of the icon.

Rückgabewert

Success: The icon handle.
Failure: 0 and sets the @error flag to non-zero, @extended flag may contain the HRESULT error code.

Bemerkungen

When you are finished using the icon, destroy it using the _WinAPI_DestroyIcon() function.

This function requires Windows Vista or later.

Verwandte Funktionen

_WinAPI_DestroyIcon

Siehe auch

Suche nach LoadIconWithScaleDown in der MSDN Bibliothek.

Beispiel

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
#include <SendMessage.au3>
#include <StaticConstants.au3>
#include <WinAPIIcons.au3>
#include <WinAPISys.au3>

If Number(_WinAPI_GetVersion()) < 6.0 Then
    MsgBox(($MB_ICONERROR + $MB_SYSTEMMODAL), 'Fehler', 'Benötigte Windows Vista oder neuer.')
    Exit
EndIf

GUICreate('Test ' & StringReplace(@ScriptName, '.au3', '()'), 324, 324)
GUICtrlCreateIcon('', 0, 64, 64, 196, 196)
Local $h_Icon = GUICtrlGetHandle(-1)
GUISetState(@SW_SHOW)

Local $hIcon = _WinAPI_LoadIconWithScaleDown(0, @ScriptDir & '\Extras\Soccer.ico', 196, 196)
Local $hPrev = _SendMessage($h_Icon, $STM_SETIMAGE, 1, $hIcon)
If $hPrev Then
    _WinAPI_DestroyIcon($hPrev)
EndIf

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE