[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: 780
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
User avatar
joedf
Posts: 6292
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: 780
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

Return to “Scripts and Functions”

Who is online

Users browsing this forum: No registered users and 6 guests