Funktionreferenz


_WinAPI_Create32BitHBITMAP


Creates a 32 bits-per-pixel bitmap from the specified icon

#include <WinAPIGdi.au3>
_WinAPI_Create32BitHBITMAP ( $hIcon [, $bDib = False [, $bDelete = False]] )

Parameter

$hIcon Handle to the source icon.
$bDib [optional] Specifies whether to create device-independent (DIB) or device-dependent (DDB) bitmap, valid values:
True - Creates DIB.
False - Creates DDB (Default).
$bDelete [optional] Specifies whether to delete the icon after the function is successful, valid values:
    True - Icon will be deleted if the function succeeds.
    False - Do not delete, you must release the icon when you are finished using it (Default).

Rückgabewert

Success: Handle to the created bitmap.
Failure: 0 and sets the @error flag to non-zero.

Bemerkungen

The _WinAPI_Create32BitHBITMAP() creates a 32 bits-per-pixel bitmap with alpha chanel (if possible) from the icons with any color depth.
The function internally converts the specified icon to the 32 bits-per-pixel icon.

When you are finished using the bitmap, destroy it using the _WinAPI_DeleteObject() function.

Verwandte Funktionen

_WinAPI_DeleteObject

Beispiel

#NoTrayIcon

#include <GUIMenu.au3>
#include <MsgBoxConstants.au3>
#include <WinAPIGdi.au3>
#include <WinAPIShellEx.au3>
#include <WinAPISys.au3>

Opt('TrayMenuMode', 3)

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

Local $hMenu = TrayItemGetHandle(0)
Local $iOptions = TrayCreateItem('Options')
TrayCreateItem('')
Local $idExit = TrayCreateItem('Exit')

_GUICtrlMenu_SetItemBmp($hMenu, 0, _WinAPI_Create32BitHBITMAP(_WinAPI_ShellExtractIcon(@SystemDir & '\shell32.dll', 207, 16, 16), 1, 1))
_GUICtrlMenu_SetItemBmp($hMenu, 2, _WinAPI_Create32BitHBITMAP(_WinAPI_ShellExtractIcon(@SystemDir & '\shell32.dll', 131, 16, 16), 1, 1))

TraySetState()

Do
Until TrayGetMsg() = $idExit