[x64 & x32 fix] DeskIcons - Get/Set Desktop Icon Positions

Post your working scripts, libraries and tools
Guest_3102018a

Re: [x64 & x32 fix] DeskIcons - Get/Set Desktop Icon Positions

10 Mar 2018, 15:26

I can't say. All I know is that I experience the same issue as tempuser. Sometimes the script works, sometimes it doesn't. Is it possible that both our issues stem from "OpenProcess" not working? Maybe, but it seems from the warning that iProcessID is blank, which results in OpenProcess not working. Having placed a Msgbox in the code, sometimes hwWindow is blank, which would make "WinGet, iProcessID, PID" blank and so on down the line. My humble opinion is that one of the "ControlGet, hwWindow" commands is failing, which leads the other functions to fail.
User avatar
Flipeador
Posts: 997
Joined: 15 Nov 2014, 21:31
GitHub: Flipeador
Location: Argentina
Contact:

Re: [x64 & x32 fix] DeskIcons - Get/Set Desktop Icon Positions

10 Mar 2018, 22:38

It works well on my Windows 10 :)
I have made a version for AHK v2:

Code: [Select all] [Expand] [Download] (Untitled.ahk)GeSHi © Codebox Plus


Updated: 04/07/2018 (mdy)


joedf wrote:Thanks for post this Flipeador.

No problem, thanks to you for sharing the code ;)
Windws 1♂ Pro 64-Bits I make scripts for AHKv2 (my v2 compiler) & WIN_7+ Spanish Argentina SublimeText 3 & AHKv2 My GDI+ Library
User avatar
joedf
Posts: 6433
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada, Quebec
Contact:

Re: [x64 & x32 fix] DeskIcons - Get/Set Desktop Icon Positions

12 Mar 2018, 08:29

Thanks for post this Flipeador.
I will link to it in the first post along with some kind of fix when I find the time :b
ahbi
Posts: 14
Joined: 15 Jun 2016, 17:11

Re: [x64 & x32 fix] DeskIcons - Get/Set Desktop Icon Positions

06 Apr 2018, 23:07

DeskIcons() is nice as far as it goes, but I am at a loss as to how to take the next step, setting arbitrary icon positions.

If I dump out coords I get

Code: [Select all] [Download] GeSHi © Codebox Plus

This PC:47318090
Recycle Bin:53150794
Handbrake:64816202


That 64816202 number (for Handbrake) must be a coordinate or related to one.

And by adding the following to DeskIcons()

Code: [Select all] [Download] GeSHi © Codebox Plus

DllCall("ReadProcessMemory", "ptr", hProcess, "ptr", pItemCoord, "UInt", &iCoord, "UInt", 8, "UIntP", cbReadWritten)
THE_ITEMNAME := A_LoopField
THE_X_COORD := NumGet(iCoord,"Int")
THE_Y_COORD := Numget(iCoord, 4,"Int")
ret .= A_LoopField ":" (NumGet(iCoord,"Int") & 0xFFFF) | ((Numget(iCoord, 4,"Int") & 0xFFFF) << 16) "`n"


I can see that Handbrake (via iCoord) is at X: 1098 & Y: 989, which are Relative positions. Checking with WinSpy that agrees.

But I am not sure how I arbitrarily set a coordinate for the icon.

If I want to move the Handbrake icon from its original position to ... say .. X: 2000 & Y: 1500, how would I go about that?

What is that packing and bit shifting that occurs with the ret variable?

Thanks
User avatar
Flipeador
Posts: 997
Joined: 15 Nov 2014, 21:31
GitHub: Flipeador
Location: Argentina
Contact:

MAKEWORD | MAKELONG | MAKELONG64 | LOWORD | HIWORD | LOBYTE | HIBYTE | LOLONG | HILONG

07 Apr 2018, 08:28

ahbi wrote:If I want to move the Handbrake icon from its original position to ... say .. X: 2000 & Y: 1500, how would I go about that?

Do you want to set the position of a specific icon?; We need another function for this (Not necessarily, but it would be fine). *I have added SetDeskIconPos to my previous Script.

ahbi wrote:What is that packing and bit shifting that occurs with the ret variable?

See the lParam parameter of the LVM_SETITEMPOSITION message. You need to package the coordinates (x;y) in a 32-bit integer. See MAKELONG macro | Packaging values in DWORD.

Code: [Select all] [Expand] [Download] (BitPacking.ahk)GeSHi © Codebox Plus

Windws 1♂ Pro 64-Bits I make scripts for AHKv2 (my v2 compiler) & WIN_7+ Spanish Argentina SublimeText 3 & AHKv2 My GDI+ Library
iPhilip
Posts: 288
Joined: 02 Oct 2013, 12:21

Re: [x64 & x32 fix] DeskIcons - Get/Set Desktop Icon Positions

09 Jul 2018, 18:27

Hi Folks,

Can this script be adapted to get the dimensions of the icons as well, perhaps through LVM_GETSUBITEMRECT? Ultimately, I am trying to find a way to get the name of the icon under the mouse.

Thank you,

iPhilip
Windows 7 Pro (64 bit) - AutoHotkey v1.1+ (Unicode 32-bit)
User avatar
jeeswg
Posts: 4952
Joined: 19 Dec 2016, 01:58
Location: UK

Re: [x64 & x32 fix] DeskIcons - Get/Set Desktop Icon Positions

09 Jul 2018, 22:01

- Here's a way to get the name of the file under the cursor via Acc:
Explorer: get name of file under cursor - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=51788

- Some information re. view modes and hence icon sizes:
Reading Win 10 File Explorer View Mode - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=28304
- There are techniques here to get a window object for the Desktop/Explorer windows.
Explorer window interaction (folder windows/Desktop, file/folder enumeration/selection/navigation/creation) - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=35041
Last edited by jeeswg on 10 Jul 2018, 00:30, edited 2 times in total.
iPhilip
Posts: 288
Joined: 02 Oct 2013, 12:21

Re: [x64 & x32 fix] DeskIcons - Get/Set Desktop Icon Positions

10 Jul 2018, 00:11

Thank you jeeswg,

I appreciate your resourcefulness. I look forward to trying that in the morning.

iPhilip
Windows 7 Pro (64 bit) - AutoHotkey v1.1+ (Unicode 32-bit)

Return to “Scripts and Functions”

Who is online

Users browsing this forum: au6, Davidb, Hotte and 8 guests