elsemieni Posted April 28, 2017 Share Posted April 28, 2017 Hello there! I'm trying to build something for animating desktop icons (adding/removing/change position/icon/properties). After a little research, I figure that Windows Desktop is in fact a ListView, that can be manipulated with the included GuiListView.au3 UDF. So, I made some small demo to see how works, but I have different results in different Windows versions. Demo objectives: Obtain the HWND of the desktopListView. Add a dummy icon in the desktop. Changing some properties (position, label). Show current desktop icons info. Here's the code I made for that: #Include <GuiListView.au3> #include <Array.au3> $hWnd = ControlGetHandle("Program Manager", "", "[CLASS:SysListView32; INSTANCE:1]") ;adding new dummy icon $nuevoControl = _GUICtrlListView_AddItem ( $hWnd, "TEST", 32, 2 ) ;changing some properties _GUICtrlListView_SetItemPosition ( $hWnd, $nuevoControl, 300, 300 ) _GUICtrlListView_SetItemText ( $hWnd, $nuevoControl, "text" ) ;show desktop icons info $aDeskIcon = GetIconInfo() _ArrayDisplay($aDeskIcon, "Desktop shortcut names and icon positions") Func GetIconInfo() Local $hWnd = ControlGetHandle("Program Manager", "", "[CLASS:SysListView32; INSTANCE:1]") If @error Then Return 0 Dim $GIP[_GUICtrlListView_GetItemCount($hWnd)+1][4] If Not IsArray($GIP) Then Return 0 $GIP[0][0] = UBound($GIP) -1 For $i = 1 To $GIP[0][0] $GIP[$i][0] = _GUICtrlListView_GetItemText($hWnd, $i -1) $GIP[$i][1] = _GUICtrlListView_GetItemPositionX($hWnd, $i -1) $GIP[$i][2] = _GUICtrlListView_GetItemPositionY($hWnd, $i -1) $GIP[$i][3] = _GUICtrlListView_GetItemImage ( $hWnd, $i -1) Next Return $GIP EndFunc Here's the behaivour between different OSes (32 bit OS, 32bit AutoIt3): Windows 9x-XP : It works fine (Yes, tested in windows 95 too and works pretty well xD). It add's a new dummy visible icon, then it moves to 100,100 with name "text" and shows all icon's info correctly. Windows 7: It doesn't create any icon. _GUICtrlListView_AddItem returns 999999999 which it's an unexpected value (in UDF documentation tells there's a -1 value if there's an error). If I use _GUICtrlListView_InsertItem instead _GUICtrlListView_AddItem it creates a dummy empty icon but I can't change any properties of them. Windows 10: Doesn't create any icons, can't read any icon from Desktop. I researched some things about this and I'm just figuring some differences in how Windows renders the screen since Vista (GPU v/s software), but I don't think that affects desktop structure. So my question is: There's something wrong how I'm manipulating icons in Windows 7? (I can live without 10, that's not a problem hehe). Or my approach to handle it was wrong? There's another efficent way to handle desktop icons to make animations? Some idea you can tell us everybody here? Thanks in advance 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