Yashied Posted April 6, 2009 Share Posted April 6, 2009 (edited) LAST VERSION - 1.802-Nov-09Deprecated.The library contains three basic functions. I always use these functions and decided to share them with the community. I hope that to some of you they will be useful. To understand why this is done, please look at my examples.History1.8Updated the reducing flicker algorithm - _Icons_Control_Update(), now the upper windows will be redrawn.Improved performance for all main functions.Added one new example to benchmark the reducing flicker algorithm.Fixed few minor bugs.1.7Completely rewritten the internal code of the library.]$fErase parameter replaced to $hOverlap that makes the opposite effect. (See description)All the internal functions have been renamed.Added some internal functions. (See expamples 5 and 6)Function _Icons_Icon_Merge() (formerly _Icons_CombineIcon()) now works with icon handles.Improved performance for the _SetCombineBkIcon() function.Added two new examples.1.6Added compatibility with the MrCreatoR's GUICtrlSetOnHover UDF library. (See GUICtrlSetOnHover & Icons UDFs Demonstration below)Added mode to reduce flickering when changing images in the controls.Added parameter $fErase for all functions. Because the reduce flickering mode is enabled by default, but in some cases it must be disabled. (See example 4)Fixed bug consists in the wrong determinates the size of controls after cleaning their by using _SetImage($hWnd, "") or _SetHImage($hWnd, 0) functions.Fixed bug consists in the wrong determinates the background color of the icons in _SetCombineBkIcon() function if the window is invisible.Internal _Icons_SetImage() function is completely rewritten and improved.Slightly improved performance.1.5Added resizing image, depending on the size of control. (Thanks wraithdu, Post #19)Added some new opportunities for _SetCombineBkIcon() function. (See description inside the library)Now you can use the one handle for the few controls. _SetHIcon() and _SetHImage() function makes a copy of HIcon and HBitmap handles.Added the ability to automatically determine the background color of the window for the _SetCombineBkIcon() function.Fixed bug consists in the wrong value of the $SS_BITMAP constant. (Thanks wraithdu, Post #17)Fixed bug consists in memory leaks when using _SetImage() and _SetHImage() functions. (Thanks wraithdu, Post #28)Fixed bug consists in unnecessary to convert the values for the style.The code was completely rewritten and improved.Added four new examples.Available functionsBasic_SetCombineBkIcon_SetIcon_SetImageAdditional_SetHIcon_SetHImageNot documented (Internal)_Icons_Bitmap_Crop_Icons_Bitmap_CreateFromIcon_Icons_Bitmap_CreateSolidBitmap_Icons_Bitmap_Duplicate_Icons_Bitmap_GetSize_Icons_Bitmap_IsAlpha_Icons_Bitmap_IsHBitmap_Icons_Bitmap_Load_Icons_Bitmap_Resize_Icons_Control_CheckHandle_Icons_Control_CheckSize_Icons_Control_Enum_Icons_Control_FitTo_Icons_Control_GetRect_Icons_Control_GetSize_Icons_Control_Invalidate_Icons_Control_SetImage_Icons_Control_Update_Icons_Icon_Duplicate_Icons_Icon_Extract_Icons_Icon_CreateFromBitmap_Icons_Icon_GetSize_Icons_Icon_Merge_Icons_System_GetColor_Icons_System_SwitchColorIcons UDF Library v1.8Previous downloads: 1268Icons.au3Exampleexpandcollapse popup#Include <GUIConstantsEx.au3> #Include <Icons.au3> Global Const $sPng = RegRead('HKLM\SOFTWARE\AutoIt v3\AutoIt', 'InstallDir') & '\Examples\GUI\Advanced\Images\Torus.png' Global Const $sJpg = @TempDir & '\~wallpaper.jpg' Global Const $sGreen = @TempDir & '\~green.png' Global Const $sRed = @TempDir & '\~red.png' Global Const $sLogo = @TempDir & '\~logo.png' Example1() Example2() Example3() Example4() Example5() Example6() Example7() Func Example1() GUICreate('Example1', 204, 108) $Icon1 = GUICtrlCreateIcon('', 0, 30, 38, 32, 32) $Icon2 = GUICtrlCreateIcon('', 0, 88, 38, 32, 32) $Icon3 = GUICtrlCreateIcon('', 0, 146, 38, 32, 32) GUISetState() _SetCombineBkIcon($Icon1, -1, @SystemDir & '\shell32.dll', 70, 32, 32, @SystemDir & '\shell32.dll', 22, 24, 24, 0, 8) _SetCombineBkIcon($Icon2, -1, @SystemDir & '\shell32.dll', 3, 32, 32, @SystemDir & '\shell32.dll', 28, 32, 32) _SetCombineBkIcon($Icon3, -1, @SystemDir & '\shell32.dll', 220, 32, 32, @SystemDir & '\shell32.dll', 29, 32, 32) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example1 Func Example2() GUICreate('Example2', 216, 128) $Icon = GUICtrlCreateIcon('', 0, 40, 40, 48, 48) GUICtrlCreateIcon(@WindowsDir & '\explorer.exe', 0, 128, 40, 48, 48) GUISetState() _SetIcon($Icon, @WindowsDir & '\explorer.exe', 0, 48, 48) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example2 Func Example3() GUICreate('Example3', 715, 388) $Pic1 = GUICtrlCreatePic('', 10, 10, 386, 368) $Pic2 = GUICtrlCreatePic('', 406, 10, 193, 184) $Pic3 = GUICtrlCreatePic('', 609, 10, 96, 92) GUISetState() _SetImage($Pic1, $sPng) _SetImage($Pic2, $sPng) _SetImage($Pic3, $sPng) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example3 Func Example4() GUICreate('Example4', 253, 244) $Pic1 = GUICtrlCreatePic('', 10, 10, 193, 184) $Pic2 = GUICtrlCreatePic('', 60, 60, 193, 184) GUISetState() _SetImage($Pic2, $sPng) _SetImage($Pic1, $sPng) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example4 Func Example5() Local $aIndex[10] = [4, 13, 23, 31, 86, 104, 130, 150, 168, 170] GUICreate('Example5', 600, 400) $Pic = GUICtrlCreatePic('', 0, 0, 600, 400) For $i = 1 To UBound($aIndex) GUICtrlCreatePic('', Random(0, 600 - 48, 1), Random(0, 400 - 48, 1), 48, 48) $hIcon = _Icons_Icon_Extract(@SystemDir & '\shell32.dll', $aIndex[$i - 1], 48, 48) $hBitmap = _Icons_Bitmap_CreateFromIcon($hIcon) _SetHImage($Pic + $i, $hBitmap) _WinAPI_DeleteObject($hBitmap) _WinAPI_DestroyIcon($hIcon) Next GUISetState() InetGet('http://dota.ru/3d/big/p324_42.jpg', $sJpg) $hBitmap = _Icons_Bitmap_Load($sJpg) $hArea = _Icons_Bitmap_Crop($hBitmap, 420, 320, 600, 400) _SetHImage($Pic, $hArea) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteObject($hArea) FileDelete($sJpg) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example5 Func Example6() GUICreate('Example6', 800, 500) $Background = GUICtrlCreatePic('', 0, 0, 800, 500) GUICtrlSetState(-1, $GUI_DISABLE) $Button = GUICtrlCreateButton('Test', 355, 460, 90, 23) $Pic1 = GUICtrlCreatePic('', 102, 122, 256, 256) $Pic2 = GUICtrlCreatePic('', 442, 122, 256, 256) GUISetState() InetGet('http://autoit.rv.ua/files/Pictures/icons_ex_back.jpg', $sJpg) InetGet('http://autoit.rv.ua/files/Pictures/icons_ex_green.png', $sGreen) InetGet('http://autoit.rv.ua/files/Pictures/icons_ex_red.png', $sRed) _SetImage($Background, $sJpg) $hGreen = _Icons_Bitmap_Load($sGreen) $hRed = _Icons_Bitmap_Load($sRed) _SetHImage($Pic1, $hRed) _SetHImage($Pic2, $hRed) FileDelete($sJpg) FileDelete($sGreen) FileDelete($sRed) $pCtrlID = 0 While 1 $Cursor = GUIGetCursorInfo() If @error Then ContinueLoop EndIf $nCtrlID = $Cursor[4] If $nCtrlID <> $pCtrlID Then Switch $pCtrlID Case $Pic1 _SetHImage($Pic1, $hRed) Case $Pic2 _SetHImage($Pic2, $hRed, -1) EndSwitch Switch $nCtrlID Case $Pic1 _SetHImage($Pic1, $hGreen) Case $Pic2 _SetHImage($Pic2, $hGreen, -1) EndSwitch $pCtrlID = $nCtrlID EndIf $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE ExitLoop Case $Button GUICtrlSetState($Button, $GUI_DISABLE) For $i = 1 To 50 GUIGetMsg() _SetHImage($Pic1, $hGreen) _SetHImage($Pic2, $hGreen, -1) Sleep(50) _SetHImage($Pic1, $hRed) _SetHImage($Pic2, $hRed, -1) Sleep(50) Next GUICtrlSetState($Button, $GUI_ENABLE) EndSwitch WEnd GUIDelete() EndFunc ;==>Example6 Func Example7() GUICreate('Example7', 400, 93) $Pic = GUICtrlCreatePic('', 0, 0, 400, 93) $hIcon = _Icons_Icon_Extract(@SystemDir & '\shell32.dll', 86, 24, 24) $hBitmap = _Icons_Bitmap_CreateFromIcon($hIcon) For $i = 1 To 5 GUICtrlCreatePic('', 258 + ($i - 1) * 28, 12, 24, 24) _SetHImage($Pic + $i, $hBitmap) Next _WinAPI_DeleteObject($hBitmap) _WinAPI_DestroyIcon($hIcon) GUISetState() InetGet('http://www.autoitscript.com/forum/public/style_images/autoit/logo.png', $sLogo) $hBitmap = _Icons_Bitmap_Load($sLogo) $hArea = _Icons_Bitmap_Crop($hBitmap, 0, 7, 400, 93) _SetHImage($Pic, $hArea) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteObject($hArea) FileDelete($sLogo) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example7GUICtrlSetOnHover & Icons UDFs DemonstrationIcons_Hover.zip Edited December 25, 2013 by Yashied Wiliat87 and Parsix 2 My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
GEOSoft Posted April 6, 2009 Share Posted April 6, 2009 I haven't tried it but what is the use of Example 2 when we can just use GUICtrlSetImage($Icon, @WindowsDir & '\explorer.exe', 0) George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Yashied Posted April 6, 2009 Author Share Posted April 6, 2009 I haven't tried it but what is the use of Example 2 when we can just useGUICtrlSetImage($Icon, @WindowsDir & '\explorer.exe', 0)Try and see the result. My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
GEOSoft Posted April 6, 2009 Share Posted April 6, 2009 Try and see the result.This is one of those things that I have no use for right now and don't remember when I would have used it. Of course it's also one of those threads that I will be searching for someday. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Yashied Posted April 6, 2009 Author Share Posted April 6, 2009 (edited) This is one of those things that I have no use for right now and don't remember when I would have used it. Of course it's also one of those threads that I will be searching for someday.Screenshort Edited October 28, 2009 by Yashied My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
jennico Posted April 14, 2009 Share Posted April 14, 2009 (edited) i find this very interesting and maybe this can answer a long asked question of mine. ico files use to consist of several icons in different resolutions/sizes and color palettes. sometimes they bear even completely different images. is there a way to determine all the included specifications and hence display exactly one specific bitmap in the ico file ? guictrlsetimage only differenciates between large and small, for _WinAPI_PrivateExtractIcon you need to specify the size. j. Edited April 14, 2009 by jennico Spoiler I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.Don't forget this IP: 213.251.145.96 Â Link to comment Share on other sites More sharing options...
Yashied Posted May 12, 2009 Author Share Posted May 12, 2009 This library has been updated. My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
martin Posted May 30, 2009 Share Posted May 30, 2009 This library has been updated.This is an excellent udf Yashied and it solves a problem many people have had with icons, especially the transparency, or lack of it, when using gifs with the standard AutoIt function. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Zedna Posted May 30, 2009 Share Posted May 30, 2009 Nice/handy UDF Yashied!! Five stars from me. Resources UDF Â ResourcesEx UDF Â AutoIt Forum Search Link to comment Share on other sites More sharing options...
James Posted May 30, 2009 Share Posted May 30, 2009 Very useful! Thanks for the great UDF! Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Yashied Posted May 30, 2009 Author Share Posted May 30, 2009 jennico, martin, Zedna, JamesBrooks, All thanks. My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
Emiel Wieldraaijer Posted May 31, 2009 Share Posted May 31, 2009 Thanks Does it's job really good Best regards, Emiel Best regards,Emiel Wieldraaijer Link to comment Share on other sites More sharing options...
GameIDevelp Posted June 15, 2009 Share Posted June 15, 2009 ,hi..why I have this error ? \AutoIt3\Include\Icons.au3 (107) : ==> "Func" statement has no matching "EndFunc".: Link to comment Share on other sites More sharing options...
James Posted June 15, 2009 Share Posted June 15, 2009 What version of AutoIt are you running GameIDevelp? Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
GEOSoft Posted June 15, 2009 Share Posted June 15, 2009 ,hi..why I have this error ? \AutoIt3\Include\Icons.au3 (107) : ==> "Func" statement has no matching "EndFunc".:Did you download the file or just Copy/Paste from the first post? If the latter make sure you got it all. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
wipped Posted June 15, 2009 Share Posted June 15, 2009 Hi nice job Link to comment Share on other sites More sharing options...
wraithdu Posted June 16, 2009 Share Posted June 16, 2009 I noticed in several places you do something like BitOR($Style, Hex($SS_ICON)) There's no reason for the Hex() conversion, especially since it returns a string. Definitely not something you want to use in a BitOR(). Other than that, a really nice UDF. It would be nice to be able to resize images in your _SetImage() / _SetHImage() functions. Link to comment Share on other sites More sharing options...
GameIDevelp Posted June 17, 2009 Share Posted June 17, 2009 autoit version 1.71 ,, stil get error at line 107 . Link to comment Share on other sites More sharing options...
wraithdu Posted June 17, 2009 Share Posted June 17, 2009 Here's the _SetImage() function that allows resizing. Fortunately, the GdipGetImageThumbnail function preserves image transparency I've not tried this for increasing the size of an image, as far as quality goes. I also found an AutoIt error. The value for SS_BITMAP should be 14, while it is defined as 15 in StaticConstants.au3. When you fix my above notation about Hex($SS_BITMAP), the _SetImage() function will stop working until your fix this error in the AutoIt include file. expandcollapse popupfunc _SetImage($hWnd, $sImage, $iW = -1, $iH = -1) const $STM_SETIMAGE = 0x0172 local $hImage, $hBitmap, $Style, $Error = false if not IsHWnd($hWnd) then $hWnd = GUICtrlGetHandle($hWnd) if $hWnd = 0 then return SetError(1, 0, 0) endif endif _GDIPlus_Startup() $hImage = _GDIPlus_BitmapCreateFromFile($sImage) If $iW > 0 And $iH > 0 Then ; resize Local $aResult = DllCall($ghGDIPDll, "int", "GdipGetImageThumbnail", _ "hwnd", $hImage, _ "int", $iW, _ "int", $iH, _ "int*", 0, _ "ptr", 0, _ "ptr", 0) $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($aResult[4]) _GDIPlus_ImageDispose($aResult[4]) Else $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) EndIf if $hBitmap = 0 then return SetError(1, 0, 0) endif $Style = _WinAPI_GetWindowLong($hWnd, $GWL_STYLE) if @error then $Error = 1 else _WinAPI_SetWindowLong($hWnd, $GWL_STYLE, BitOR($Style, $SS_BITMAP)) if @error then $Error = 1 else _WinAPI_DeleteObject(_SendMessage($hWnd, $STM_SETIMAGE, $IMAGE_BITMAP, 0)) _SendMessage($hWnd, $STM_SETIMAGE, $IMAGE_BITMAP, $hBitmap) if @error then $Error = 1 endif endif endif _WinAPI_DeleteObject($hBitmap) _GDIPlus_BitmapDispose($hImage) _GDIPlus_Shutdown() return SetError($Error, 0, not $Error) endfunc; _SetImage Link to comment Share on other sites More sharing options...
Yashied Posted June 26, 2009 Author Share Posted June 26, 2009 The library has been updated. My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now