Mat Posted May 2, 2009 Share Posted May 2, 2009 Is any one else finding this? I use this to get icon names + indexes, yet when I then use SetIcon or something - it is using the wrong icon. eg: I want icon 21, and i select it from the dialog, I then copy the result and use it in a script, yet it comes out wrong, but I can correct it by adding 1. I have tried it with lots of things, always with the same result $Ret = DllCall("shell32.dll", "int", "PickIconDlg", "hwnd", 0, "wstr", "", "int", 1000, "int*", 0) InputBox ("Icon", "The icon name is:", FileGetShortName ($Ret[2] & ", " & $Ret[4]), "", -1, 100) am i going mad? MDiesel AutoIt Project Listing Link to comment Share on other sites More sharing options...
Yashied Posted May 2, 2009 Share Posted May 2, 2009 Is any one else finding this? I use this to get icon names + indexes, yet when I then use SetIcon or something - it is using the wrong icon. eg: I want icon 21, and i select it from the dialog, I then copy the result and use it in a script, yet it comes out wrong, but I can correct it by adding 1. I have tried it with lots of things, always with the same result $Ret = DllCall("shell32.dll", "int", "PickIconDlg", "hwnd", 0, "wstr", "", "int", 1000, "int*", 0) InputBox ("Icon", "The icon name is:", FileGetShortName ($Ret[2] & ", " & $Ret[4]), "", -1, 100) am i going mad? MDieselGUICtrlCreateIcon($Ret[2], - (1 + $Ret[4]), 40, 40, 32, 32) 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...
DeeRiee Posted May 2, 2009 Share Posted May 2, 2009 Try this expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 263, 181, 211, 202) $Button1 = GUICtrlCreateButton("Select Icon", 72, 24, 97, 25, 0) $icon = GUICtrlCreateIcon("", "", 100, 65) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $Button1 $aRet =_PickIconDlg(@SystemDir & "shell32.dll", 8, WinGetHandle("")) If Not @error Then GUICtrlSetImage($icon, $aRet[0], -$aRet[1] - 1) case $msg = $GUI_EVENT_CLOSE Exit EndSelect WEnd Func _PickIconDlg($sFileName, $nIconIndex=0, $hWnd=0) Local $nRet, $aRetArr[2] $nRet = DllCall("shell32.dll", "int", "PickIconDlg", _ "hwnd", $hWnd, _ "wstr", $sFileName, "int", 1000, "int*", $nIconIndex) If Not $nRet[0] Then Return SetError(1, 0, -1) $aRetArr[0] = $nRet[2] $aRetArr[1] = $nRet[4] Return $aRetArr EndFunc Link to comment Share on other sites More sharing options...
Mat Posted May 2, 2009 Author Share Posted May 2, 2009 (edited) so i'm not mad then. good. everyones just been adding -1's all along. $Ret = DllCall("shell32.dll", "int", "PickIconDlg", "hwnd", 0, "wstr", "", "int", 1000, "int*", 0) InputBox ("Icon", "The icon name is:", FileGetShortName ($Ret[2]) & ", " & $Ret[4] + 1, "", -1, 100) thats better! Edited May 2, 2009 by mdiesel AutoIt Project Listing Link to comment Share on other sites More sharing options...
Yashied Posted May 2, 2009 Share Posted May 2, 2009 (edited) so i'm not mad then. good. everyones just been adding -1's all along. $Ret = DllCall("shell32.dll", "int", "PickIconDlg", "hwnd", 0, "wstr", "", "int", 1000, "int*", 0) InputBox ("Icon", "The icon name is:", FileGetShortName ($Ret[2]) & ", " & $Ret[4] + 1, "", -1, 100) thats better!No. - ($Ret[4] + 1) EDIT: PickIconDlg() returns the correct (zero based) values. If you use GUICtrlCreateIcon() or GUICtrlSetImage() then you need to put a negative value. Edited May 2, 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...
WideBoyDixon Posted May 3, 2009 Share Posted May 3, 2009 I believe Yashied. I think the past few days makes Yashied the icon guru [center]Wide by name, Wide by nature and Wide by girth[u]Scripts[/u]{Hot Folders} {Screen Calipers} {Screen Crosshairs} {Cross-Process Subclassing} {GDI+ Clock} {ASCII Art Signatures}{Another GDI+ Clock} {Desktop Goldfish} {Game of Life} {3D Pie Chart} {Stock Tracker}[u]UDFs[/u]{_FileReplaceText} {_ArrayCompare} {_ToBase}~ My Scripts On Google Code ~[/center] Link to comment Share on other sites More sharing options...
Yashied Posted May 3, 2009 Share Posted May 3, 2009 I believe Yashied. I think the past few days makes Yashied the icon guru 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