WinAPI for AutoArrange Desktop icons

Just starting out? Need help? Post your questions and find answers here.
eJan
Enthusiast
Enthusiast
Posts: 366
Joined: Sun May 21, 2006 11:22 pm
Location: Sankt Veit am Flaum

WinAPI for AutoArrange Desktop icons

Post by eJan »

I need API call to set permanently AutoArrange & Align to Grid for Desktop icons. I Have tried using Registry but it doesn't work with Reatogo-X-PE. Please help!
Last edited by eJan on Sun Sep 03, 2006 12:55 pm, edited 1 time in total.
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

Code: Select all

; Set desktop icons to permanently autoarrange
hWnd = FindWindow_("Progman", 0) 
hWnd = GetWindow_(hWnd, #GW_CHILD) 
hWnd = GetWindow_(hWnd, #GW_CHILD) 
SetWindowLong_(hWnd, #GWL_STYLE, GetWindowLong_(hWnd, #GWL_STYLE) | #LVS_AUTOARRANGE | #LVS_ALIGNLEFT)
BERESHEIT
eJan
Enthusiast
Enthusiast
Posts: 366
Joined: Sun May 21, 2006 11:22 pm
Location: Sankt Veit am Flaum

Post by eJan »

Thanks netmaestro, unfortunately it doesn't work under XP even with:

Code: Select all

mouse_event_(#MOUSEEVENTF_RIGHTDOWN,0,0,0,0) : mouse_event_(#MOUSEEVENTF_RIGHTUP,0,0,0,0)
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

I'm running XP pro SP2, if I uncheck autoarrange on my desktop and move a few icons around, then run that code they all straighten up and autoarrange becomes checked. I couldn't guess at all why it might not work on another machine with the same os.
BERESHEIT
techjunkie
Addict
Addict
Posts: 1126
Joined: Wed Oct 15, 2003 12:40 am
Location: Sweden
Contact:

Post by techjunkie »

netmaestro wrote:

Code: Select all

; Set desktop icons to permanently autoarrange
hWnd = FindWindow_("Progman", 0) 
hWnd = GetWindow_(hWnd, #GW_CHILD) 
hWnd = GetWindow_(hWnd, #GW_CHILD) 
SetWindowLong_(hWnd, #GWL_STYLE, GetWindowLong_(hWnd, #GWL_STYLE) | #LVS_AUTOARRANGE | #LVS_ALIGNLEFT)
Works fine here; WinXP Pro SP2 (english) , if I turn off "Auto Arrange".
Image
(\__/)
(='.'=) This is Bunny. Copy and paste Bunny into your
(")_(") signature to help him gain world domination.
eJan
Enthusiast
Enthusiast
Posts: 366
Joined: Sun May 21, 2006 11:22 pm
Location: Sankt Veit am Flaum

Post by eJan »

Sorry, yes it works - I have look only at checked-unchecked popupmenu. :D
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

Hm. I guess you have to tell the registry somewhere that the style got changed, otherwise the checks won't show accurately. A bit of sleuthing with Regshot ought to reveal where and what.
BERESHEIT
Post Reply