Jump to content



Photo

Icons UDF


  • Please log in to reply
68 replies to this topic

#1 Yashied

Yashied

    Happy in Moscow

  • MVPs
  • 2,513 posts

Posted 06 April 2009 - 12:17 PM

LAST VERSION - 1.8
02-Nov-09

Deprecated.

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.


Posted Image



History

Spoiler



Icons UDF Library v1.8
(Previous downloads: 1268)

Attached File  Icons.au3   42KB   3281 downloads


Example

Spoiler



GUICtrlSetOnHover & Icons UDFs Demonstration

Posted Image

Icons_Hover.zip

Edited by Yashied, 20 March 2012 - 11:41 PM.








#2 GEOSoft

GEOSoft

    Sure I'm senile. What's your excuse?

  • MVPs
  • 10,565 posts

Posted 06 April 2009 - 12:41 PM

I haven't tried it but what is the use of Example 2 when we can just use
GUICtrlSetImage($Icon, @WindowsDir & '\explorer.exe', 0)
GeorgeQuestion 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!"

#3 Yashied

Yashied

    Happy in Moscow

  • MVPs
  • 2,513 posts

Posted 06 April 2009 - 12:50 PM

I haven't tried it but what is the use of Example 2 when we can just use
GUICtrlSetImage($Icon, @WindowsDir & '\explorer.exe', 0)

Try and see the result.

#4 GEOSoft

GEOSoft

    Sure I'm senile. What's your excuse?

  • MVPs
  • 10,565 posts

Posted 06 April 2009 - 01:00 PM

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.
GeorgeQuestion 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!"

#5 Yashied

Yashied

    Happy in Moscow

  • MVPs
  • 2,513 posts

Posted 06 April 2009 - 02:05 PM

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 by Yashied, 28 October 2009 - 08:18 AM.


#6 jennico

jennico

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 862 posts

Posted 14 April 2009 - 11:27 AM

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 by jennico, 14 April 2009 - 11:28 AM.

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.Posted ImageDon't forget this IP: 213.251.145.96

#7 Yashied

Yashied

    Happy in Moscow

  • MVPs
  • 2,513 posts

Posted 12 May 2009 - 11:39 AM

This library has been updated.

#8 martin

martin

    ~~\o/~~~/0\=¬''~~~

  • MVPs
  • 7,202 posts

Posted 30 May 2009 - 09:26 AM

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.

#9 Zedna

Zedna

    AutoIt rulez!

  • MVPs
  • 8,409 posts

Posted 30 May 2009 - 10:14 AM

Nice/handy UDF Yashied!!

Five stars from me.

#10 James

James

    jbrooksuk

  • MVPs
  • 9,498 posts

Posted 30 May 2009 - 11:25 AM

Very useful! Thanks for the great UDF!

#11 Yashied

Yashied

    Happy in Moscow

  • MVPs
  • 2,513 posts

Posted 30 May 2009 - 04:08 PM

jennico, martin, Zedna, JamesBrooks,

All thanks.

#12 Emiel Wieldraaijer

Emiel Wieldraaijer

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 654 posts

Posted 31 May 2009 - 09:42 AM

Thanks

Does it's job really good

Best regards,

Emiel
Best regards,Emiel WieldraaijerPosted Image

#13 GameIDevelp

GameIDevelp

    Seeker

  • Active Members
  • 45 posts

Posted 15 June 2009 - 11:29 AM

,hi..

why I have this error ?

\AutoIt3\Include\Icons.au3 (107) : ==> "Func" statement has no matching "EndFunc".:

#14 James

James

    jbrooksuk

  • MVPs
  • 9,498 posts

Posted 15 June 2009 - 02:13 PM

What version of AutoIt are you running GameIDevelp?

#15 GEOSoft

GEOSoft

    Sure I'm senile. What's your excuse?

  • MVPs
  • 10,565 posts

Posted 15 June 2009 - 03:06 PM

,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.
GeorgeQuestion 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!"

#16 wipped

wipped

    Seeker

  • Active Members
  • 16 posts

Posted 15 June 2009 - 06:53 PM

Hi nice job

#17 wraithdu

wraithdu

    I am less fun than a twisted ankle.

  • MVPs
  • 2,140 posts

Posted 16 June 2009 - 11:10 PM

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.

#18 GameIDevelp

GameIDevelp

    Seeker

  • Active Members
  • 45 posts

Posted 17 June 2009 - 06:52 AM

autoit version 1.71 ,, stil get error at line 107 .

#19 wraithdu

wraithdu

    I am less fun than a twisted ankle.

  • MVPs
  • 2,140 posts

Posted 17 June 2009 - 04:42 PM

Here's the _SetImage() function that allows resizing. Fortunately, the GdipGetImageThumbnail function preserves image transparency :D 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.

AutoIt         
func _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


#20 Yashied

Yashied

    Happy in Moscow

  • MVPs
  • 2,513 posts

Posted 26 June 2009 - 04:03 PM

The library has been updated.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users