Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <WinAPI.au3>
- #include <GDIPlus.au3>
- ; -Author: name22 (www.autoit.de)
- $iStart = 3
- $iIcons = 5
- $t_ahIcons = DllStructCreate("HWND[" & $iIcons & "]")
- $p_ahIcons = DllStructGetPtr($t_ahIcons)
- _WinAPI_ExtractIconEx(@SystemDir & "\shell32.dll", $iStart, 0, $p_ahIcons, $iIcons)
- _GDIPlus_Startup()
- For $i = 1 To $iIcons
- $hBitmap = _GDIPlus_BitmapCreateFromHICON(DllStructGetData($t_ahIcons, 1, $i))
- _GDIPlus_ImageSaveToFile($hBitmap, @ScriptDir & StringFormat("\Icon%02d.bmp", $i))
- _GDIPlus_BitmapDispose($hBitmap)
- _WinAPI_DestroyIcon(DllStructGetData($t_ahIcons, 1, $i))
- Next
- _GDIPlus_Shutdown()
- ; #FUNCTION# ====================================================================================================================
- ; Name...........: _GDIPlus_BitmapCreateFromHICON
- ; Description ...: Creates a Bitmap object based on an icon
- ; Syntax.........: _GDIPlus_BitmapCreateFromHICON($hIcon)
- ; Parameters ....: $hIcon - Handle to an icon
- ; Return values .: Success - Returns a handle to a new Bitmap object
- ; Failure - 0 and either:
- ; |@error and @extended are set if DllCall failed
- ; |$GDIP_STATUS contains a non zero value specifying the error code
- ; Remarks .......: After you are done with the object, call _GDIPlus_ImageDispose to release the object resources
- ; Related .......: _GDIPlus_ImageDispose, _WinAPI_LoadImage, _WinAPI_LoadIcon
- ; Link ..........; @@MsdnLink@@ GdipCreateBitmapFromHICON
- ; Example .......; Yes
- ; ===============================================================================================================================
- Func _GDIPlus_BitmapCreateFromHICON($hIcon)
- Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromHICON", "hwnd", $hIcon, "int*", 0)
- If @error Then Return SetError(@error, @extended, 0)
- $GDIP_STATUS = $aResult[0]
- Return $aResult[2]
- EndFunc ;==>_GDIPlus_BitmapCreateFromHICON
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement