Search the Community
Showing results for tags 'guictrlcreateicon'.
-
This is a little tool that displays the contents of a DLL icon file. It shows how to use icons on buttons and as stand alone images. #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.14.5 Author: Skysnake Script Function: Display content of DLL icon files #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> ;Local $rDLLpath = @SystemDir & "\Wmploc.dll" ;Local $rDLLpath = @SystemDir & "\imageres.dll" ;Local $rDLLpath = @SystemDir & "\shell32.dll" ;Local $rDLLpath = @SystemDir & "\pifmgr.dll" ;Local $rDLLpath = @SystemDir & "\explorer.exe" ;Local $rDLLpath = @SystemDir & "\accessibilitycpl.dll" ;Local $rDLLpath = @SystemDir & "\ddores.dll" ;Local $rDLLpath = @SystemDir & "\moricons.dll" ; ugly do not use ;Local $rDLLpath = @SystemDir & "\mmcndmgr.dll ;Local $rDLLpath = @SystemDir & "\netshell.dll" ;Local $rDLLpath = @SystemDir & "\ieframe.dll" Local $rDLLpath = @SystemDir & "\wiashext.dll" For $r = 0 To -50 Step -10 ConsoleWrite($r & @CRLF) GUICreate("Show Icons") Local $lblShowRange = GUICtrlCreateLabel("Icons " & $r - 1 & " to " & $r - 10, 8, 8, 100, 25) Local $btnIcon1 = GUICtrlCreateButton("", 8, 25, 24, 24, $BS_ICON) GUICtrlSetImage($btnIcon1, $rDLLpath, $r - 1, 0) ; GUICtrlCreateIcon($rDLLpath, $r - 1, 40, 25, 24, 24) ; 2nd Local $btnIcon2 = GUICtrlCreateButton("", 8, 50, 24, 24, $BS_ICON) GUICtrlSetImage($btnIcon2, $rDLLpath, $r - 2, 0) ; GUICtrlCreateIcon($rDLLpath, $r - 2, 40, 50, 24, 24) ; 3rd Local $btnIcon3 = GUICtrlCreateButton("", 8, 75, 24, 24, $BS_ICON) GUICtrlSetImage($btnIcon3, $rDLLpath, $r - 3, 0) ; GUICtrlCreateIcon($rDLLpath, $r - 3, 40, 75, 24, 24) ;4th Local $btnIcon4 = GUICtrlCreateButton("", 8, 100, 24, 24, $BS_ICON) GUICtrlSetImage($btnIcon4, $rDLLpath, $r - 4, 0) ; GUICtrlCreateIcon($rDLLpath, $r - 4, 40, 100, 24, 24) ;5th Local $btnIcon5 = GUICtrlCreateButton("", 8, 125, 24, 24, $BS_ICON) GUICtrlSetImage($btnIcon5, $rDLLpath, $r - 5, 0) ; GUICtrlCreateIcon($rDLLpath, $r - 5, 40, 125, 24, 24) ;6th Local $btnIcon6 = GUICtrlCreateButton("", 8, 150, 24, 24, $BS_ICON) GUICtrlSetImage($btnIcon6, $rDLLpath, $r - 6, 0) ; GUICtrlCreateIcon($rDLLpath, $r - 6, 40, 150, 24, 24) ;7th Local $btnIcon7 = GUICtrlCreateButton("", 8, 175, 24, 24, $BS_ICON) GUICtrlSetImage($btnIcon7, $rDLLpath, $r - 7, 0) ; GUICtrlCreateIcon($rDLLpath, $r - 7, 40, 175, 24, 24) ;8th Local $btnIcon8 = GUICtrlCreateButton("", 8, 200, 24, 24, $BS_ICON) GUICtrlSetImage($btnIcon8, $rDLLpath, $r - 8, 0) ; GUICtrlCreateIcon($rDLLpath, $r - 8, 40, 200, 24, 24) ;9th Local $btnIcon9 = GUICtrlCreateButton("", 8, 225, 24, 24, $BS_ICON) GUICtrlSetImage($btnIcon9, $rDLLpath, $r - 9, 0) ; GUICtrlCreateIcon($rDLLpath, $r - 9, 40, 225, 24, 24) ;10th Local $btnIcon10 = GUICtrlCreateButton("", 8, 250, 24, 24, $BS_ICON) GUICtrlSetImage($btnIcon10, $rDLLpath, $r - 10, 0) ; GUICtrlCreateIcon($rDLLpath, $r - 10, 40, 250, 24, 24) ; Display the GUI. GUISetState(@SW_SHOW) Sleep(3000) GUIDelete() Next
-
- guictrlcreateicon
- $bs_icon
-
(and 1 more)
Tagged with:
-
Recently I was working on a script with icons using GuiCtrkCreatIcon. I decided to change the sub folder name of the icons to a more meaning name, however made a typo. I tested the .exe on my test computer and it worked flawlessly (because both icon folder where on my test computer) 😁 But after I installed the script on the intended computers , I got chaos!😵 Zooming into the problem, I discovered, that because the icons could not be found, the ControlID were returned with a value of 0 and thus played havoc within the GuiGetMsg() switch/case statement. I have been able to reproduce this (see example) #include <GUIConstantsEx.au3> ;============================================================================================================ ; PLEASE, do not save this example in the example folder: C:\Program Files (x86)\AutoIt3\Examples\Helpfile ;============================================================================================================ Example() Func Example() GUICreate(" My GUI Icons", 250, 250) $Icon1 = GUICtrlCreateIcon("shell32.dll", 10, 20, 20) $Icon2 = GUICtrlCreateIcon(@ScriptDir & '\Extras\horse.ani', -1, 20, 40, 32, 32) $Icon3 = GUICtrlCreateIcon("shell32.dll", 7, 20, 75, 32, 32) GUISetState(@SW_SHOW) ;$Icon2 = -1 ; ==> When this line is uncommented the script "works", so -1 could be a potential fix. ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $Icon2 Beep (500,500) EndSwitch WEnd GUIDelete() EndFunc ;==>Example If you save the above script outside the Autoit example folder and run it, it will keep beeping because GuiCtrlCreatIcon did not find horse.ani and return $Icon2=0. At the moment GUICtrlCreateIcon () only returns the conntrolID on success and 0 on failure. I would like to propose a return of -1 on failure, so a existing and working script won't go awry when the icon can not be found.
- 11 replies
-
- guictrlcreateicon
- switch
-
(and 3 more)
Tagged with:
-
So if you embed an animated cursor on a GUI with GUICtrlCreateIcon the animation goes quite slow. Is there a way to speed it up? #include <GUIConstants.au3> GUICreate('', 64, 64) GUICtrlCreateIcon('C:\windows\cursors\aero_busy_l.ani', 0, 0, 0, 64, 64) GUISetState() While GUIGetMsg() <> $GUI_EVENT_CLOSE WEnd Edit: See attached .gif for an example of the difference. On the top is the cursor viewed in an image viewer, on the bottom is in an AutoIt GUI. Notice how much slower it is in AutoIt.
-
Okay, so here's what I'm dealing with: I'm having a series of icons created from separate GuiCtrlCreateIcon-controls. All them each have a unique icon-name/number to icons inside a .dll. What I'd like to achieve here is to be able of reading that name/number once the icon has been clicked with f.ex. a GuiCtrlRead-command or so. Why I want this done is because I'm then going to use that number in a IniRead-function where that number will be a key with a certain value, so basicly "linking" that icon to that key/line in the .ini. Is this achieveable, or would it just be easier to use a $n = n and then set GuiCtrlCreateIcon(".dll",$n,..,..,..,..) for each icon-control? Thanks in advance! Best regards, zvvyt