PioRey Posted July 26, 2010 Posted July 26, 2010 Hi to all, Just want to ask if anyone knows how to get the icon from a listview? I've attached the file in here. The image has a listview which has an icon on a column, how will I be able to get that icon and put it into another listview within the application? appreciate any help I can get.. Thanks.
evilertoaster Posted July 26, 2010 Posted July 26, 2010 I think the question is a little confusing, or lacking context... have you looked at _GUIImageList_GetIcon() ?
PsaltyDS Posted July 26, 2010 Posted July 26, 2010 On 7/26/2010 at 9:54 PM, 'evilertoaster said: I think the question is a little confusing, or lacking context... have you looked at _GUIImageList_GetIcon() ?...after using _GUICtrlListView_GetImageList() to get the image list handle for use in _GUIImageList_GetIcon(). Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
PioRey Posted July 27, 2010 Author Posted July 27, 2010 Can you post a sample script to start with? Thanks.
PioRey Posted July 29, 2010 Author Posted July 29, 2010 Please help me on this..... have been searching the answer for days..
KaFu Posted July 29, 2010 Posted July 29, 2010 Take a look at the examples for _GUICtrlListView_SetImageList and _GUIImageList_AddIcon in the UDF help-file. OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16)
PioRey Posted July 30, 2010 Author Posted July 30, 2010 Hi, tried that functions but what I need is get the icons used from a Listview control in the external app. I've used this functions and seems not working for me ; returns the ImageList used on the Listview control on the external app $hImageList = _GUICtrlListView_GetImageList($hListview, 0) ; Try this one and returns 0??? Why? _GUIImageList_GetImageCount($hImageList) Thanks.
KaFu Posted July 30, 2010 Posted July 30, 2010 (edited) Never tried that, maybe _GUIImageList_Duplicate() works, where $hWnd is the handle of the source listview. Then use _GUIImageList_GetIcon() to extract the needed icons. Edited July 30, 2010 by KaFu OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16)
PioRey Posted July 30, 2010 Author Posted July 30, 2010 Tried that one but no luck. I've used the _GUICtrlListView_GetImageList and it returns the handle value but using the _GUIImageList_GetImageCount it returns 0, can you please help me? Thanks.
PioRey Posted July 30, 2010 Author Posted July 30, 2010 Posting the codes below... expandcollapse popup;====================================== ; Helper Files ; #include <GuiListView.au3> #include <GuiImageList.au3> #include <ListviewConstants.au3> #include <GuiConstantsEx.au3> #include <GuiTreeView.au3> ;====================================== ; Explicit variable declaration Opt('MustDeclareVars', 1) ;====================================== ; Variables ; Global Const $APPNAME = "Resource Updating Manager" Global Const $hTreeview = ControlGetHandle($APPNAME, "", "[CLASS:WindowsForms10.SysTreeView32.app.0.378734a; NAME:MainTree]") Global Const $hListview = ControlGetHandle($APPNAME, "", "[CLASS:WindowsForms10.SysListView32.app.0.378734a; NAME:ComputersList]") Global Const $SMALL_ICONS = 1 ;====================================== ; Script starts here _Main() Func _Main() Local $hImageList, $frmSample, $ListView1 Local $nRow, $nCol Local $tmpImageList, $hIcons[2], $lIndex ; Draw form $frmSample = GUICreate("Sample", 255, 300, 192, 114) $ListView1 = GUICtrlCreateListView("", 8, 8, 234, 262, $LVS_REPORT) $hImageList = _GUICtrlListView_GetImageList($hListview, 1) ; Returned value = 0x00193500 _OutputToMsgbox(_GUIImageList_GetImageCount($hImageList)) ; Returned value = 0 is this correct??? GUISetState(@SW_SHOW) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc Func _OutputToMsgbox($nMsg) MsgBox(0, "", $nMsg) EndFunc
PsaltyDS Posted July 30, 2010 Posted July 30, 2010 Here's your belated chastisement for double-posting... As posted in the other topic, my attempt at a demo reading the icon details from an explorer window's listview failed in similar fashion. This makes me wonder if you can do this with a listview not owned by your script's process. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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