HICON ist einfach. Das in eine Datei speichern ist aufwendig. Anfang:
Spoiler anzeigen
#include <gdiplus.au3>
#include <windowsconstants.au3>
#include <constants.au3>
Global Const $DIB_RGB_COLORS = 0
Func _GDIPlus_BitmapCreateHICONFromBitmap($hBitmap)
; Prog@ndy
Local $result = DllCall($ghGDIPDLL, "int", "GdipCreateHICONFromBitmap", "ptr", $hBitmap, "ptr*", 0)
If @error Then Return SetError(1,1,0)
Return SetError($result[0],0,$result[2])
EndFunc
Global Const $tagBITMAP = "LONG bmType; LONG bmWidth; LONG bmHeight; LONG bmWidthBytes; ushort bmPlanes; ushort bmBitsPixel; ptr bmBits; "
Global Const $tagBITMAPINFOHEADER = "DWORD biSize; LONG biWidth; LONG biHeight; ushort biPlanes; ushort biBitCount DWORD biCompression; DWORD biSizeImage; LONG biXPelsPerMeter; LONG biYPelsPerMeter; DWORD biClrUsed; DWORD biClrImportant;"
Global Const $tagICONDIRHEADER = "ushort idReserved; ushort idType; ushort idCount;"
Global Const $tagICONDIRENTRY = _
"BYTE bWidth; " & _ ;// Width, in pixels, of the image
"BYTE bHeight; " & _ ;// Height, in pixels, of the image
"BYTE bColorCount; " & _ ;// Number of colors in image (0 if >=8bpp)
"BYTE bReserved; " & _ ;// Reserved ( must be 0)
"ushort wPlanes; " & _ ;// Color Planes
"WORD wBitCount; " & _ ;// Bits per pixel
"DWORD dwBytesInRes;" & _ ;// How many bytes in this resource?
"DWORD dwImageOffset;" ;// Where in the file is this image?
_GDIPlus_Startup()
[/autoit] [autoit][/autoit] [autoit]$hBitmap = _GDIPlus_ImageLoadFromFile(@MyDocumentsDir & "\eigene bilder\au3.png")
[/autoit] [autoit][/autoit] [autoit]$hIcon = _GDIPlus_BitmapCreateHICONFromBitmap($hBitmap)
$aInfo = _WinAPI_GetIconInfo($hIcon)
$hGraphics = _GDIPlus_ImageGetGraphicsContext($hBitmap)
$hDC = _GDIPlus_GraphicsGetDC($hGraphics)
$bmpinfo = DllStructCreate($tagBITMAPINFO)
DllStructSetData($bmpinfo, 1, DllStructGetSize($bmpinfo)-4)
$info = DllStructCreate($tagBITMAP)
[/autoit] [autoit][/autoit] [autoit]_WinAPI_GetObject($aInfo[4], DllStructGetSize($info), DllStructGetPtr($info) )
[/autoit] [autoit][/autoit] [autoit]_WinAPI_GetDIBits($hDC, $aInfo[4], 0, DllStructGetData($info, 3), 0, DllStructGetPtr($bmpinfo), $DIB_RGB_COLORS)
MsgBox(0, '', DllStructGetData($bmpinfo, 3))
_GDIPlus_GraphicsReleaseDC($hGraphics, $hDC)
_GDIPlus_GraphicsDispose($hGraphics)
_WinAPI_DestroyIcon($hIcon)
_GDIPlus_ImageDispose($hBitmap)
_GDIPlus_Shutdown()
da fehlt aber noch einiges.
http://msdn.microsoft.com/en-us/library/ms997538.aspx
http://en.wikipedia.org/wiki/ICO_(icon…#File_structure
http://msdn.microsoft.com/en-us/library/ms648052(VS.85).aspx
...